Sign in to follow this  
EternityZA

multi-pass rendering breaks my transparency

Recommended Posts

EternityZA    1226
Hey. i currently use multipass rendering to draw all the lights in my scene in my first pass i use a shader that renders the faces with ambient lighting. for every pass after that i use a shader that renders 2 diffuse lights until theres no more lights left to render. this works fine and all but transparent textures doesnt show up correctly (as it did when i still used only 1 pass). transparent parts of the texture is stil transparent but parts that should be completely opaque are only about 50% opaque for some reason. im not sure how all the different blending functions work or which one i should be using so im guessing i might just be using the wrong one or the problem might be in my shaders. any thoughts on what might cause this? Thnx in Advance!

Share this post


Link to post
Share on other sites
Schrompf    1035
The standard usage of Alphablending is (ALPHA, INVALPHA). That means that the new pixel color on screen is a mixture of the pixel shader output (multiplied with alpha) and the previous screen color at this point (multiplied with One Minus Alpha). On the other side, additional passes for lights are usually done with (ONE, ONE), which means that the pixel shader output and the screen color simply add up.

For multipass transparent surfaces you have to mix both approaches. The first pass should be (ALPHA, INVALPHA) like standard alpha blending. But now the previos pixel colour at that screen is already reduced by the alphablending. All additional passes should now use (ALPHA, ONE) to avoid reducing the previous screen color further.

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