Jump to content
  • Advertisement
Sign in to follow this  
skow

Blend problem with depth write disabled (done)

This topic is 4887 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

I’m working on some vegetation (fields of plants) that are done with hundreds of bill-boarded sprites. I’m taking advise from the article “Toward Photorealism in Virtual Botany” and not sorting them from back to front, and instead making them simi transparent (with a noise transparency map) so you should be able to see ones though another and not have an obvious cutoff line. So I draw with depth writing disabled, blending enabled using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); and I’m not getting the expected results I’m looking for. In the below picute I have an example of the problem. In the top ½ I draw front to back, there is a sharp cutoff instead of a blended transition (like it isn’t bending and just overwrites the color data. Below that I draw back to front and it blends nicely. I have a picture of the texture I’m using for the grass. I don’t understand why it isn’t bending correctly. [Edited by - skow on June 2, 2005 4:21:26 PM]

Share this post


Link to post
Share on other sites
Advertisement
with src_alpha , 1-src_alpha u need to sort back to front (not necessary with other blend modes eg one one)
u dont need to sort if u use alpahtest eg glalphafunc( GL_GRATEER, 0.0 ) and disable blending (depthwrites + depthtest on, blending off)
though it might look a bit hard around edges
so try depthwrites off, blend with src_alpha 1-src_alpha, depthtest on and sort back to front this will give the best visual results

Share this post


Link to post
Share on other sites
Well I would rather not resort to using alpha testing. Also sorting back to front has too much of a performance impact. I really like the idea behind the “noise transparent” grass to avoid sorting.

I don’t understand why GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA wont work. Why won’t it blend with the objects behind it? Does it ONLY blend with objects that have written to the depth buffer? I would think there is a way to blend it in a way I need as it has been implemented in that article.

Share this post


Link to post
Share on other sites
I haven't read the article you refer to. Does it require a first pass to fill the depth buffer? Also, does it specify that depth testing should be disabled?

Share this post


Link to post
Share on other sites
Quote:
Original post by _the_phantom_
hmmm have you tried it with depth testing off as well?


Yes, with depth testing turned off I get the same shopped action when drawing from front to back.

And my mistake, I reread the article, and they do use alpha testing, just call it alpha blending thoughout the article. *sigh* Ignore this post, I’m a retard.

EDIT: Guess this is a case of late night reading and reading what i wanted to see, not what was there. It's a shame its alpha tested, doesnt look near as good as sorted alpha blended plants.

[Edited by - skow on June 2, 2005 4:15:08 PM]

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!