Skip to main content
GameDev.net gamedev.net
🔒 Locked

Transparent walls with isometric view

Started by yzq89 Jun 7, 2005 at 10:24 AM 5 replies 4.6k views
Original Post
yzq89
yzq89
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)?
Aeluned
Aeluned
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).
yzq89
yzq89
I see. Thanks for the clarification; I'll go with making the whole wall/object translucent for the time being.
renderer
renderer
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.
yzq89
yzq89
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.
Rasmadrak
Rasmadrak
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... :)
"Game Maker For Life, probably never professional thou." =)
zedzeek
zedzeek
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.