SFML community forums

Help => General => Topic started by: Martin336 on April 14, 2015, 10:28:09 pm

Title: Dynamic trasparency
Post by: Martin336 on April 14, 2015, 10:28:09 pm
Well, fancy name for a thread, but in principle I would like to reproduce an effect that I have observed in Fallout 2. When the character was behind the wall, the wall became localy transparent.

I would like to know the approach for such effect. Intuition tells me, that the "walls" are affected by transparent texture drawn ower them (following the main character), that makes them localy transparent.

Could you give me at least the term, describing the effect? I dont even know what to google (regarding the SFML).
Title: Re: Dynamic trasparency
Post by: AlexAUT on April 14, 2015, 11:11:04 pm
I would use the stencil buffer to achieve this effect.

Steps:
1.)Draw the floor and objects of the floor and the character.
2.)Then draw a circle around the character to the stencil buffer (set to 1),
3.)Draw the walls only where the stencil buffer is not 1

Maybe this links gives you an idea: http://www.learnopengl.com/#!Advanced-OpenGL/Stencil-testing

AlexAUT