This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

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.
Notice
Transparent objects also can be rendered in the deferred pass. It can be defined in the Common tab of the material. Look up the table to know more.

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.

Option Pass Description Blending to set
Opaque Deferred for opaque objects Used for opaque materials No blending
Alpha blend Forward for transparent objects Standard alpha blending Src = src alpha
Dest = one minus src alpha
Additive Forward for transparent objects Color addition Src = one
Dest = one
Multiply Forward for transparent objects Color multiplication Src = dest color
Dest = zero
Deferred alpha blend Deferred for transparent objects Rendered over opaque materials to the G-buffer, alpha blending is used No blending
Custom Forward for transparent objects Used for custom configurations Custom

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.

Notice
Use the render_show_textures console command to show current set of buffers used by the renderer.

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.

Two transparent objects, rendered in deferred pass.

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.

Two transparent objects, rendered in forward pass.

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 buffer

Auxiliary buffer with contours

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:

Different auxiliary colors and transparency

Auxiliary color rendered onto the screen
Last update: 03.07.2017
Build: ()