Jump to content
  • Advertisement
Sign in to follow this  

ideas for drawing translucent overlay in occluded region

This topic is 673 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 a hobbyist project and I'm struggling to create a particular effect. The game has an isometric or at least top down perspective and has a fixed camera orientation. I want to be able to show some kind of translucent overlay for characters when they occluded behind level geometry in the foreground. This idea is probably easiest to show with an image, this is taken from the game Pillars of Eternity:




As you can see where the character is hidden by the wall they draw this grey semi transparent outline. So this needs to be in regions where the characters are occluded but only by specific things, not for example by each other.


So the first idea I had was:


-create a frame buffer to render to so we can have a new depth buffer

-render the subset of level geometry we are interested in. meaning the foreground walls and such to the depth buffer only, using some kind of no op fragment shader

-render the characters in the transparent manner using an inverted depth test, i.e using glDepthFunc(GL_GEQUAL) and glDepthMask(GL_FALSE)

-draw the buffer to the screen


I thought this would mean that it draws the characters only in the region where the walls are found in front of it. Unfortunately this is causing strange behaviour, that particular combination of glDepthFunc and glDepthMask seems to cause problems regardless of whether I use the FBO or not. It's a bit hard to explain and understand the issues, but I get black marks and streaks on the screen.


Anyway so my question is, should I expect any problems using depth testing with writing to the depth buffer disabled, as I think it has to be.


Alternatively can anyone suggest a better strategy for this kind of problem?


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!