Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Dynamic trasparency  (Read 1027 times)

0 Members and 1 Guest are viewing this topic.

Martin336

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Dynamic trasparency
« 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).

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: Dynamic trasparency
« Reply #1 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
« Last Edit: April 14, 2015, 11:12:38 pm by AlexAUT »