Jump to content
  • Advertisement
Sign in to follow this  
RichardGe

binary alpha

This topic is 1088 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,

 

In order to avoid the need of sorting the objects that need a simple binary alpha mask, I'm forcing  the alpha transparancy to be only 0 or 1.

 

asup_tra.png

 

 

To do that, I have added this line in all my pixel shaders :


//force alpha to 0 or 1
if ( finalColor.w > 0.5f ) { finalColor.w = 1.0f; } else { finalColor.w = 0.0f; }

This doesn't seem very beautiful.

I'm wondering if there is another way to do that ?

Like a DirectX implemented feature ?

 

Thank you !

Share this post


Link to post
Share on other sites
Advertisement

For bonus points, use this technique to avoid jaggies on your foliage (not invented by Wolfire, but they have a relatively short clear explanation): http://blog.wolfire.com/2009/02/rendering-plants-with-smooth-edges/

 

TLDR version: Render all foliage twice. First pass use clip/discard/alpha test on your foliage (as Hodgman describes). Second pass, render with alpha blending.

 

A more correct solution might be to look into alpha-to-coverage with multi-sample antialiasing.

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!