Render loop
- Last UpdatedDec 04, 2023
- 2 minute read
The Render loop is divided into two main functions:
-
Render. Performs the actual rendering including scene traversing, mesh faces drawing, pixel shading, buffer generation, post processing (including HDR, FGI, AO).
-
Present. Copies the rendered buffer on the screen buffer.
Render Loop execution
At each Render Loop execution, both render and present are executed one time.
Present and V-sync
In case V-sync is supported (Graphics.display.vsynch parameter of config.xml) the screen buffer drawing must be synchronized with the actual screen drawing. This means that present must wait for the V-sync signal before being called.
There are two disadvantages:
-
Rendering FPS can, at maximum reach actual screen refresh rate.
-
The delay between the end of render and the beginning of present may reduce the frame rate, especially in static mode.
Rendering loop configuration parameters
These parameters influence the rendering loop behavior.
|
Parameter |
Path |
Description |
|---|---|---|
|
RenderPath |
Graphics/renderSetupFilePath |
Some paths overrides the other settings. For example, Oculus Rift path is executed as static with no possibility to change it. |
|
Loop Type |
Scene.fps.type |
Use this to select between:
|
|
FPSGame |
Scene.fps.game |
Defines the target game loop frame rate. |
|
FPSRender |
Scene.fps.render |
Defines the target render loop frame rate. |
|
Timers |
Scene.fps.useTimers |
If True, the game loop and the render loop are called by Windows timers. Otherwise they are .NET threads. When using the engine embedded into a windows application, the setting is ignored and the timers are used by default. |
|
FPSPhysx |
Graphics.physx.simPerSec |
Defines the target physx frame rate. |
|
V-sync |
Graphics.display.vsync |
If True, present waits for vertical sync signal. If False, can cause screen tearing and other defects. |