Jump to content
  • Advertisement
Sign in to follow this  
MotionCoil

Depth Function to use in this situation

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

Hey I just got blending sorted out in my editor which is fun and makes a pretty level. However, I am coming across a few problems- that being my depth function is culling polygons that should be seen through translucent polygons. Heres my example:
 ______
|      |
|  []  |
|______|

   ^
   |
 Front
Imagine that to be 2 3D cubes (but from the top). The little cube is dead in the centre of the bigger cube. Now, I have set it so the 'front' face of the big surrounding cube is translucent but the rest of the faces are infact totally solid. I want to be able to see the little cube through the translucent front face. At the moment my depthfunc is set to GL_LEQUAL however this just culls the little cube. If I set it to always...well you can just imagine how screwed my level looks after that. Is there a way around it like setting the depth func to something different if there is a translucent object, then setting it back again to LEQUAL. Or is there another way... Thanks in advance -Moco

Share this post


Link to post
Share on other sites
Advertisement
the 'traditional' way of solving this problem is to render all semi-transparent surfaces AFTER all the soild one in order from back to front, with depth testing on but depth writes off.

So, in this instance you'd draw your cubes, missing out the transparent front face and then do a transparent pass where you draw the front face in.

Share this post


Link to post
Share on other sites
Cheers, I never knew that. Guess these are things you pick up on the way.

I'll give that a try, it'll be easy to implement in my world view [smile]

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!