Kuesa Runtime

ForwardRenderer QML Type

Implements a simple forward rendering FrameGraph. More...

Since: Kuesa 1.0
Instantiates: ForwardRenderer


Detailed Description

This FrameGraph will select all Qt3D Entities that reference a Material with Techniques having a FilterKey with the name "renderingStyle" set to the string value "forward".

The rendering will be made on a single viewport whose dimensions can be set with normalized coordinates by setting the viewportRect property.

The screen will be cleared with the color set with the clearColor property. By default the clear color is black.

Unless clearBuffers has been set appropriately, only the color and depth buffers will be cleared before the rest of the scene is rendered.

The scene will be rendered from the camera property on the window or offscreen surface specified by the renderSurface property. Additionally, setting externalRenderTargetSize will specify the size of the rendering surface, when different from the size reported by the surface, this can be the case with high DPI screens.

Frustum culling of Entities will be performed by default to only render entities that are visible within the camera's frustum. This can be disabled by setting the frustumCulling property. Please note frustum culling is not performed on skinned meshes.

By default the rendering is performed so that:

Opaque object are rendered first: Entities having a Material with a compatible RenderPass that has a FilterKey KuesaDrawStage with a value set to Opaque will be rendered.

Transparent objects are rendered second: select all Entities having a Material with a compatible RenderPass that has a FilterKey KuesaDrawStage with a value set to Transparent will be rendered.

Scenes containing materials with transparency need to be drawn from back-to-front in relation to the Camera for the blending to work correctly. This sorting can be expensive and is disabled by default. It can be enabled by setting the backToFrontSorting to true.

In some case, an optimization technique known as an early z-filling pass can provide a significant performance gain. This is especially true for large scenes using complex rendering materials. The idea consist in filling the depth buffer with a low complexity shader so that subsequent passes incorporating more detailed rendering techniques only render fragments for the depth previously recorded. The optional z-fill pass can be enabled by setting the zFilling property to true. All Entities having a Material with a compatible RenderPass that has a FilterKey KuesaDrawStage with a value set to ZFill will be rendered. This will take place before the Opaque and Transparent pass. Only Opaque objects should be used to fill the depth buffer.

The pipeline steps, from materials to post processing effects are working in linear color space. This ForwardRenderer adds a final gamma correction to perform the final conversion to sRGB, through the use of the GammaCorrectionEffect, as the last step of this pipeline.

 import Kuesa 1.1 as Kuesa
 import Qt3D.Core 2.12
 import Qt3D.Render 2.12

 Kuesa.SceneEnity {
     id: root

     Camera { id: sceneCamera }

     components: [
         RenderSettings {
              Kuesa.ForwardRenderer {
                  clearColor: "red"
                  camera: sceneCamera
                  frustumCulling: true
                  backToFrontSorting: true
                  postProcessingEffects: [
                      BloomEffect {
                          threshold: 0.5
                          blurPassCount: 2

Property Documentation

clearBuffers : enumeration

Holds which buffers will be cleared at the start of each frame.

renderSurface : Surface

Holds the surface where rendering will occur.

views : list<View>

List of sub views of the scene to be rendered.