I have 2 HLSL ps2.0 shaders. Simplified, they are:
Shader 1
- Reads texture
- Outputs colour value based on this texture
Shader 2
- Problem: Need to read in the colour from Shader 1
- Outputs the final colour which is a function of the input colour
(They need to be different shaders as I’ve reached the maximum vertex-shader outputs for 1 shader)
My problem is I cannot work out how Shader 2 can access the existing fragment/pixel colour.
Knowing how to do any of these things with HLSL would solve my problem;
- Read existing pixel colour (I don’t think this is possible)
- Pass result of Shader 1 to Shader 2 as a float4
- Render result of Shader 1 as a texture in memory, and have Shader 2 read that in
Compositor scripts seem to be only for fullscreen (or more accurately, full viewport) effects.
Render-to-texture is the way to go. It’s not necessarily accomplished with compositor scripts.
This thread of mine on the Ogre forums goes into more detail;