Sign in to follow this  
yzq89

Transparent walls with isometric view

Recommended Posts

Hi I'm working on my isometric RPG and am trying to get walls to render transparently if they obstruct the PC. This method should work with other in-game objects, e.g. doors. I'm thinking of drawing an elliptical region around the character on the stencil buffer, and using the stencil test to prevent rendering of walls/objects in front the PC. (Layering already ensures that walls/objects in front of the PC are drawn later.) At the same time, I would like to have this transparent region transition smoothly into full opacity. I don't think this is possible with the stencil buffer; what alternative do you suggest? As a side question, if I were to go with the stencil method, would there be major performance issues (e.g. with systems that don't have a hardware stencil buffer)?

Share this post


Link to post
Share on other sites
Normally it's an all or nothing sort of thing.
If you look at say Diablo2, an entire wall or tree fades when it intersects with the character. this is done easily enough. Your method would require only
portions of obstructing objects to fade in and out. You can't just use a stencil
buffer around the PC for this because, as the character leaves that portion of the
object, it should fade back in (and yes, you can't do fading with the stencil
buffer AFAIK, and you would have performance issues if it fell back into software
mode).

Share this post


Link to post
Share on other sites
One thing that you could do would be to clear the screen alpha to 1, then draw an elipse around your PC with alpha values of not 1, then enable blending with the blending factor equal to DEST_ALPHA...that should blend the pixels that go on top of the elipse you drew, and keep everything else solid.

Share this post


Link to post
Share on other sites
Didn't get around to replying as I was away for a while.

@renderer: That's an interesting idea. I tried it out but didn't manage to get anything working. Then I read that DST_ALPHA is not supported on all devices. I'll get around to trying this again later though.

Share this post


Link to post
Share on other sites
How bout this:

Draw Walls...

Draw Character...

Redraw walls that overlap character with an alpha mask...?




of course a slight overdraw is needed, but it shouldn't be a problem... :)

Share this post


Link to post
Share on other sites
just do waht every 2.5game ever made has done just test if that section of the wall/tree whatever is in front of the player if so draw it with some transparency if not draw it solid, no need for stencil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this