Rendering Sequence
Unigine 2 rendering pipeline includes:
- Deferred rendering pass as default for all non-transparent object.
- Forward rendering pass for transparent objects.
- Auxiliary rendering pass for applying the post-process materials.
Unigine 1 has the forward renderer. All the geometry were rendered in forward passes and the number of rasterization processes depends on the number of light sources. Projects with complex scenes (which have a lot of high-poly geometry and light sources) required powerful computing resources to provide good performance.
Unigine 2 was switched to the full-deferred renderer. All opaque (non-transparent) geometry is rendered in the deferred pass. The forward rendering pass can be enabled for special transparent objects, however transparent objects also can be rendered in the deferred pass.
Deferred Pass
In the deferred pass the rasterization process happens only once that reduces the performance costs. After the rasterization process, lights are applied to the necessary buffers to create a final image of the scene.
Deferred Pass Optimization
In the deferred pass, 42 same non-transparent geometry objects (even if they have different materials) are grouped to be rendered in one draw call. Shadows have their own separate logic: 42 shadows of different meshes with different materials (that based on the mesh_base material) are grouped to be rendered in one draw call. The renderer groups only meshes (static, skinned, etc.) and doesn't group other objects (billboards, grass, etc.).
Transparent Objects
Transparency option in the Common tab of the material enables to create transparent materials for objects. Transparent objects can be rendered in the deferred pass and in the forward.
Transparent objects in the deferred pass are grouped to be rendered in one draw call. Transparent objects which were rendered in deferred pass overlap other transparent objects that were rendered in deferred pass. But deferred transparent objects provide realistic reflections and it covers almost 75% of cases when you need a transparent object.
When the transparent option is enabled, the number of draw calls for light sources will be doubled.
If the Alpha test option of the material enabled, the renderer doesn't group meshes in one draw call (and the number of draw calls will be increased), because Alpha test adds a pre-pass where the depth buffer is rendered one more time.
Forward Pass
Forward rendering pass is available only for transparent objects. To activate the forward pass, specify the Transparency option according to the table in the common tab of the material and disable deferred transparent pass in the States tab of the material.
Transparent objects are rendered in a single forward pass.
Transparent Objects
Unlike in deferred pass, transparent objects that rendered in forward pass aren't grouped, and the number of draw call increases. But it enables the sorting of transparent objects. It increases performance costs, but allows you to see another transparent object behind the first (nearest) transparent object.
Auxiliary Pass
Auxiliary pass allows you to write the contour of object with the specified material into an auxiliary color buffer (if enabled). After that, you can apply a postprocess material to it. Postprocess materials are part of the Unigine standard material library helping to render some special effect for a surface (for example, blurring, subsurface scattering, etc.)
You can also write your own shaders and apply your custom postprocess using this buffer.
Auxiliary color can also be used in an overlay color mode (used for flat-coloring of meshes in the main viewport). Depending on the alpha channel of the auxiliary color, objects are rendered fully or semi-colored: