Jump to content
  • Advertisement
Sign in to follow this  
Dom77

HLSL newbie: passing ps color output to next ps pass

This topic is 5101 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I started to look into the topic of pixel and vertex shaders. I am writing my first shader only using ps (1.1). I am calculating a new pixel value. Now in a new pass I'd like to continue my calculation based on the color value from the first pass. I couldn't find any examples which shows me clearly how to do this. Do i need to fill that color from pass1 into a struct? I though maybe it automatically gives me the color in the next pass if I declare: float ps_shader_pass2(float4 pixel : COLOR, .... but I am getting the compiler error X4530 - don't know if this is an error code from the engine or from the used 3rd party compiler (a dx error msg?). If somebody could post a simple example (in HLSL), that would be great. Thanks a lot Dom

Share this post


Link to post
Share on other sites
Advertisement
Either:

1. Set the previous pass's render target as a texture. Don't render to the same texture this pass (not valid to read and write a texture at the same time).

2. Setup your alpha blending to mix the two passes as necessary.

A sample of what alpha blending can do:
partially transparent layer (srcalpha, invsrcalpha)
additive (one, one)
scaledadditive (srcalpha, one)
modulate (destcolor, zero)
modulate2x (destcolor, srccolor)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!