3D masking question (I guess)

Hi,

I’m developing an isometric game with a freely rotatable camera.

The problem with this isometric view is that walls can block the viewport. Maybe you have seen this within games like “Neverwinter Nights”.
So, what I have to do is to blend out the objects blocking the view up to the player character. A simple “object hiding” would be the easiest (and can be done simpy by following a ray from the camera to the player char), but looks very ugly. What I want to achieve is a effect like this:

Before:

After:

The question is…how? Maybe with a shader? Or a post-process OpenGL action? Something like “attach mask to all objects in layer XY”? Any idea is welcome.

Thanks in advance!

Axel

I’ve been working towards a similar goal. Tried several approaches, the closest I got so far was using a masking layer, but it’s nowhere near good.

You could probably do some render texture magic, but I’m doing this for an iPhone game and that probably won’t work on there.

So any hints - there are at least two people interested.

You could use a shader that supports transparency on the walls, assign them to their own layer, and then reduce the main color’s opaque level if a raycast (only to the wall’s layer) hits it. And then put the opaque level back to 100% when the ray doesn’t hit anymore.

But that gives you the effect per object, or per face, not with a nice, faded circle like the example, which incidentally is the same effect I’m shooting for.

I can’t be of much help regarding the faded circle effect, but another possibility to at least make the character visible behind the wall would be to turn on back face culling in your shader. That way any polygons facing away from the camera are not rendered, and therefore do not occlude what’s on the other side of them. Wish I knew the answer to your specific question, however, as that would be a very nice effect.

You can use the depth mask shader (from the Unify wiki) in conjunction with a projector to project transparent “holes” onto objects (see this thread for details). However, I’m not sure what effect it would have on your game’s performance.