Sign in to follow this  
pisiiki

Previous pixel value in a pixel shader

Recommended Posts

Hi, I would like to know if there is a way to know the previous pixel value in a pixel shader. I want to render a bunch of screen facing quads from back to front and use the pixel colors that are already drawn to perform some calculations and get a new color to use again and again until all are drawn. I need to do this in about 2000-4000 sprites. I can't do the job with blending, I really need to solve this in a pixel shader. I'm considering now to use a temporal rendertarget and use one pass per sprite but that will be too slow. Please help me.

Share this post


Link to post
Share on other sites
The only way to read from the target you're drawing to is either with AlphaBlending, or with Stencil operations.

One option would be to use two render targets and continually swap them, but this surely wouldn't work fast enough.

Another option is to find a solution using either stenciling or blending. These would in some cases be fast enough.

Lastly, you can't read any value from the current render target in the pixel shader, so theres no option in which the current target could affect the output from the pixel shader.

Hope this helps.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
A render target approach is probably what you want. RTs are pretty quick and easy to use. Check out Shaders for Game Programmers and Artists ( http://www.amazon.com/gp/product/1592000924/ ) for good info.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this