Hi guys, I'm presently trying to implement a few post-processing effects in a pipeline (basically at an experimental stage atm), but I can't seem to get things to work.
My custom pipeline is, to a large extent, simply the forward light one extended with a post-processing stage, and it looks something like:
Code:
<Pipeline>
<Setup>
<RenderTarget id="PRBUFFER" depthBuf="true" numColBufs="1" format="RGBA8" scale="1.0" />
</Setup>
<CommandQueue>
<Stage id="Geometry" link="pipelines/globalSettings.material.xml">
<SwitchTarget target="PRBUFFER"/>
<ClearTarget depthBuf="true" colBuf0="true"/>
<DrawGeometry context="AMBIENT" class="~Translucent"/>
<DoForwardLightLoop class="~Translucent"/>
<DrawGeometry context="TRANSLUCENT" class="Translucent" order="BACK_TO_FRONT"/>
</Stage>
<Stage id="PostProcess">
<SwitchTarget target=""/>
<ClearTarget colBuf0="true"/>
<BindBuffer sampler="buf0" sourceRT="PRBUFFER" bufIndex="0"/>
<DrawQuad material="materials/pproc.material.xml" context="PPROC"/>
<UnbindBuffers/>
</Stage>
<Stage id="Overlays">
<DrawOverlays contexc="OVERLAY"/>
</Stage>
</CommandQueue>
</Pipeline>
The referenced "pproc" material looks like
Code:
<Material>
<Shader source="shaders/pproc.shader"/>
</Material>
And that shader contains
Code:
[[FX]]
sampler2D buf0 = sampler_state
{
Address = Clamp;
};
context PPROC
{
VertexShader = compile GLSL VS_FSQUAD;
PixelShader = compile GLSL FS_PPROC;
ZWriteEnable = false;
}
[[VS_FSQUAD]]
uniform mat4 projMat;
attribute vec3 vertPos;
varying vec2 texCoords;
void main( void )
{
texCoords = vertPos.xy;
gl_Position = projMat*vec4(vertPos, 1);
}
[[FS_PPROC]]
uniform sampler2D buf0;
varying vec2 texCoord;
void main(void)
{
gl_FragColor = texture2D(buf0, texCoord);
}
Now, as far as I've understood things, this ought to produce output that is identical to a normal forward lighting pass, as the post-processing pass actually doesn't do anything yet. Except, the result is that the entire screen is rendered in a single-colour (which one changes as you look around, so at least *something* is happening). Removing the post-processing stage and setting the render target to "" for the first stage results in the scene looking exactly as expected.
So, what am I missing or doing wrong?