HLSL How can one pass data between shaders / read existing colour value?

Posted by RJFalconer on Stack Overflow See other posts from Stack Overflow or by RJFalconer
Published on 2010-05-11T09:50:37Z Indexed on 2010/05/11 9:54 UTC
Read the original article Hit count: 287

Filed under:
|
|
|
|

Hello all,
I have 2 HLSL ps2.0 shaders. Simplified, they are:

Shader 1

  • Reads texture
  • Outputs colour value based on this texture

Shader 2

  • Needs to read in existing colour (or have it passed in/read from a register)
  • Outputs the final colour which is a function of the previous 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.
Is the only way for shaders to interact really just the alpha blending options? These aren't sufficient if I want to use the colour as input to my function.

© Stack Overflow or respective owner

Related posts about hlsl

Related posts about shader