Class SceneRendererDeferred
Use a Scene Renderer to traverse a scene hierarchy (made out of scene nodes and components) in order to have each visited element contribute to the result rendered against a given render context. This particular SceneRenderer uses deferred rendering.
Inheritance
Inherited Members
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public class SceneRendererDeferred : SceneRendererForward
Constructors
SceneRendererDeferred(SceneContainer, RenderLayers, TexRes, TexRes)
Creates a new instance of type SceneRendererDeferred.
Declaration
public SceneRendererDeferred(SceneContainer sc, RenderLayers renderLayer = RenderLayers.All, TexRes texRes = TexRes.Middle, TexRes shadowMapRes = TexRes.Middle)
Parameters
Type | Name | Description |
---|---|---|
SceneContainer | sc | The SceneContainer, containing the scene that gets rendered. |
RenderLayers | renderLayer | |
TexRes | texRes | The g-buffer texture resolution. |
TexRes | shadowMapRes | The shadow map resolution. |
Fields
CascadeFarPlane
Sets the distance to the far plane for the cascaded shadow mapping calculation. For smaller scenes we need to choose smaller values to get shadow maps with decent resolution.
Declaration
public int CascadeFarPlane
Field Value
Type | Description |
---|---|
System.Int32 |
NumberOfCascades
The number of shadow maps, generated when using cascaded shadow mapping for parallel lights. If set to 1 standard shadow mapping is used.
Declaration
public int NumberOfCascades
Field Value
Type | Description |
---|---|
System.Int32 |
PssmLambda
This value is used for cascaded shadow mapping. The viewing frustum is split according to the Parallel Split Shadow Maps algorithm. With this, the lambda value specifies a weight that adapts the logarithmic view frustum split according to the far planes of a uniform split. A value in the range [0;1] is expected. If it falls outside this range the value is clamped.
Declaration
public float PssmLambda
Field Value
Type | Description |
---|---|
System.Single |
Properties
BackgroundColor
Sets the GL.ClearColor
Declaration
public float4 BackgroundColor { get; }
Property Value
Type | Description |
---|---|
float4 |
FxaaOn
Controls whether the render output is anti aliased using FXAA. This is done in an additional pass that is turned off if this is set to false.
Declaration
public bool FxaaOn { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ShadowMapRes
The texture resolution in pixel, that is used to create the shadow maps for light sources that cast shadows. Note that shadow casting is only available with deferred rendering.
Declaration
public TexRes ShadowMapRes { get; }
Property Value
Type | Description |
---|---|
TexRes |
SsaoOn
Determines if the scene gets rendered with Screen Space Ambient Occlusion. This is done in an additional pass that is turned of if this is set to false. In this case the ambient component of the lighting is a static value. If possible set this in the "Init" method to avoid the creation of an SSAO texture if you don't need one.
Declaration
public bool SsaoOn { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
TexRes
The texture resolution in pixel, that is used for the G-Buffer textures.
Declaration
public TexRes TexRes { get; }
Property Value
Type | Description |
---|---|
TexRes |
Methods
InitState()
Sets the initial values in the RendererState.
Declaration
protected override void InitState()
Overrides
PopState()
Pops from the RenderState and sets the Model and View matrices in the RenderContext.
Declaration
protected override void PopState()
Overrides
Render(RenderContext)
Renders the scene.
Declaration
public override void Render(RenderContext rc)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | rc | The RenderContext. |
Overrides
RenderMesh(GpuMesh)
If a Mesh is visited the shader parameters for all lights in the scene are updated and the geometry is passed to be pushed through the rendering pipeline.
Declaration
public void RenderMesh(GpuMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
GpuMesh | mesh | The Mesh. |
RenderMesh(Mesh)
If a Mesh is visited and it has a Weight the BoneIndices and BoneWeights get set, the shader parameters for all lights in the scene are updated and the geometry is passed to be pushed through the rendering pipeline.
Declaration
public void RenderMesh(Mesh mesh)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The Mesh. |
RenderShaderEffect(Effect)
If a ShaderEffectComponent is visited the ShaderEffect of the RendererState is updated and the effect is set in the RenderContext.
Declaration
public void RenderShaderEffect(Effect effect)
Parameters
Type | Name | Description |
---|---|---|
Effect | effect | The effect. |
SetContext(RenderContext)
Sets the render context for the given scene.
Declaration
public override void SetContext(RenderContext rc)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | rc |