IRenderStage
Description
- Derived from
- Extended by
-
RenderStageBase abstract
Base interface for classes that implement a pipeline for rendering frames.
A render stage implements a frame pipeline that has the following characteristics:
-
Logarithmic Z-buffering is used, in order to allow 3D scenes to span arbitrary depth ranges.
-
Opaque geometry is rendered to a separate render target, using alpha-to-coverage or alpha-cutoff.
-
Transparent geometry is rendered to a separate render target, using order-independent transparency.
-
The sky background is rendered in a separate step.
-
Shadows are generated by using cascaded shadow-mapping.
To render a full frame, the following sequence must be performed:
-
Call Begin.
-
Call BeginShadow1 or skip to 5.
-
Call BeginShadow2 for each shadow cascade, render all shadow geometry or skip, then call End.
-
Call End.
-
Call BeginOpaque, render all opaque geometry, then call End.
-
Call BeginBackground, render the background geometry, then call End.
-
Call BeginTransparent, render all transparent geometry, then call End.
-
Call End.
The CallbackAdd method may be used to inject additional render work into an existing render stage.
- See also
Public / Methods
Begin
Begins rendering of a new frame.
The color buffer of the render target at index 1 (see RenderTargets.Get) of the current set of render targets (see IGraphicsContext.GetRenderTarget) is used as final output for the pixels of the rendered frame. The depth/stencil buffer at index 0 is used by the steps of the render stage.
GPU resources that are required by the render stage for rendering frames should be created in the IGraphicsComponent.GraphicsAttach method or in this method. If an exception is thrown by this method, the render stage will remain at the state 1 (see remarks).
- RenderException
-
If a graphics subsystem error has occurred.
- See also
BeginBackground
Begins to render the frame background.
The frame background will be visible where no opaque geometry is present, i.e. all pixels with a maximum depth value. When this render step starts, the ModelRenderer.FlushState method of Models is called.
- See also
BeginOpaque
Begins to render opaque geometry.
When this render step starts, the IBeginEnd.Begin method of Models is called and ModelRenderer.Mode is set to ModelRendererMode.OpaqueTransparent or ModelRendererMode.OpaqueTransparentNoOrder. When it ends, the ModelRenderer.FlushQueue method is called (passing 1
).
- See also
BeginShadow
2 overloads
Begins to render the cascaded shadow maps.
When this render step starts, the IBeginEnd.Begin method of Models is called and ModelRenderer.Mode is set to ModelRendererMode.Shadow. When it ends, the IBeginEnd.End method is called.
- See also
Begins to render the given shadow cascade.
When this render step ends, the ModelRenderer.FlushQueue method is called (passing 1
). The End method must always be called, regardless of the returned value.
- See also
BeginTransparent
Begins to render transparent geometry.
When this render step ends, the ModelRenderer.FlushQueue method is called (passing 2
).
- See also
CallbackAdd
Adds the given render stage callback.
If a frame is being rendered (i.e., Begin has been called without a matching call to End), callback in will be added as soon as rendering of the current frame has finished.
- See also
CallbackRemove
Removes the given render stage callback.
If a frame is being rendered (i.e., Begin has been called without a matching call to End), callback in will be removed as soon as rendering of the current frame has finished.
- See also
End
Ends the current render step.
For each call to one of the Begin*
methods, the End method must be called once.
HintHoShadow
Tells the render stage that BeginShadow1 will not be called when rendering subsequent frames.
Implementations may use this hint to release GPU resources, for example.