Jump to content
  • Advertisement
Sign in to follow this  
ehmdjii

drawing transparency correctly

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

ok, say i have a scene containing opaque and transparent objects. what i do is to first draw the opaque objects, then turn the depth-test off and draw the transparent ones. this works good, as long as not two transparent objects overlap. what if my z-order is a transparent object, an opaque object and a transparent one agai? if the depth-test is off this gives incorrect results. on NEHE i read: The correct way is to draw all the transparent (with alpha < 1.0) polys after you have drawn the entire scene, and to draw them in reverse depth order (farthest first). so how do i get the distance of a poly? and how can i change the drawing order dynamically? thanks!

Share this post


Link to post
Share on other sites
Advertisement
NeHe's described method will work as long as the transparent polygons don't intersect.

You can use the center point of the object (found using a bounding cube or sphere).

If you have intersecting polygons however this method breaks down.
In this case, the problem becomes a bit more complicated and involves finding intersection points of the polygons and subdividing them and sorting them that way.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!