|
|
@@ -687,7 +687,7 @@ Zones also define a lightmask and a shadowmask (with all bits set by default.) A
|
|
|
|
|
|
After a viewport's 3D scene content is rendered, post-processing effects can be applied to it. These are viewport-sized quads rendered with configurable vertex and pixel shaders, shader parameters and textures.
|
|
|
|
|
|
-The Viewport contains a vector of PostProcess pointers, into which they can be added. They are applied in order from first to last. Each post-processing effect can consist of a number of passes, represented by the class PostProcessPass. The last pass of the last effect will be rendered to the destination rendertarget, while the passes before will be rendered to an internal ping-pong buffer.
|
|
|
+The Viewport contains a vector of PostProcess pointers, into which they can be added, see \ref Viewport::AddPostProcess "AddPostProcess()" or \ref Viewport::InsertPostProcess "InsertPostProcess()". They are applied in order from first to last. Each post-processing effect can consist of a number of passes, represented by the class PostProcessPass. The last pass of the last effect will be rendered to the destination rendertarget, while the passes before will be rendered to an internal ping-pong buffer.
|
|
|
|
|
|
In addition to configuring programmatically, the PostProcess can be configured with a XML file; use \ref PostProcess::LoadParameters "LoadParameters()" to specify the XML file to use. The format is the following:
|
|
|
|
|
|
@@ -702,9 +702,9 @@ In addition to configuring programmatically, the PostProcess can be configured w
|
|
|
</postprocess>
|
|
|
\endcode
|
|
|
|
|
|
-Rendertargets can either specify an absolute width and height, or a divisor for the viewport size (for example sizedivisor="2 2" would divide the viewport dimensions by two.) The rendertargets are shared by all passes. A pass can output either into a rendertarget or into the viewport. The current contents of the viewport (either the scene render or a previous post-process pass) can also be read as a texture; this will always use the other half of the ping-pong buffer to avoid sampling the texture being rendered.
|
|
|
+The additional rendertargets defined by a post-process effect are temporary and allocated on-demand from the Renderer. They can either specify an absolute width and height, or a divisor for the viewport size (for example sizedivisor="2 2" would divide the viewport dimensions by two.) A pass can output either into a defined rendertarget or into the viewport. The current contents of the viewport (either the scene render or a previous post-process pass) can also be read as a texture; this will always use the other half of the ping-pong buffer to avoid sampling the texture being rendered.
|
|
|
|
|
|
-Shader parameters can be defined either as global for all passes, or as pass-specific. In addition to the user-defined shader parameters, the shader parameters GBufferOffsets and GBufferInvSize will always be set according to the viewport coordinates and the destination rendertarget inverse size, so that the GetScreenPos() shader function can operate correctly, and adjacent pixels can be sampled. See the EdgeFilter shader for an example. Finally for user-defined rendertargets the shader parameters RenderTargetNameOffsets and RenderTargetNameInvSize will be set (if they exist) to allow to sample also these rendertargets properly. In this case the "offsets" parameter represents the half-pixel UV offset needed to sample whole pixels on Direct3D9 only; on OpenGL it will be zero.
|
|
|
+%Shader parameters can be defined either as global for all passes, or as pass-specific. In addition to the user-defined shader parameters, the shader parameters GBufferOffsets and GBufferInvSize will always be set according to the viewport coordinates and the destination rendertarget inverse size, so that the GetScreenPos() shader function can operate correctly, and adjacent pixels can be sampled. See the EdgeFilter shader for an example. For the additional rendertargets the shader parameters <RenderTargetName>Offsets and <RenderTargetName>InvSize will be set (if they exist) to allow to sample also these rendertargets properly. In this case the "offsets" parameter represents the half-pixel UV offset needed to sample whole pixels on Direct3D9 only; on OpenGL it will be zero.
|
|
|
|
|
|
Note that when hardware multisampling is used in conjunction with post-processing, the multisampled backbuffer will first be resolved to the ping-pong buffer before rendering the post-process passes. This has a small performance cost.
|
|
|
|