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

Author Topic: SFML Lights  (Read 6558 times)

0 Members and 2 Guests are viewing this topic.

julescoder

  • Newbie
  • *
  • Posts: 7
    • View Profile
SFML Lights
« on: February 21, 2010, 05:10:41 pm »
Hi, is there any way to achieve 2d. lighting effects in sfml. Anyhow i am open to any suggestions. Xna can achieve this with use of hlsl, but the shader model requirements for xna is just too high was a 2d game.

Ps: I was looking for a way to implement fog of war

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
SFML Lights
« Reply #1 on: February 21, 2010, 05:30:51 pm »
I suggest SFML post-effects, it's basically GLSL fragment shaders.
http://www.sfml-dev.org/tutorials/1.6/graphics-postfx.php
Pluma - Plug-in Management Framework

julescoder

  • Newbie
  • *
  • Posts: 7
    • View Profile
SFML Lights
« Reply #2 on: February 21, 2010, 05:35:36 pm »
I not exactly sure, but isnt that for full screen post processing. I suppose 2d lights like fog war effects will require sprite specific procesiing ? (educated guess i might say?).

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
SFML Lights
« Reply #3 on: February 21, 2010, 08:27:32 pm »
You can generate a texture representing the fog and the clear areas, and a shader uses that to decide which screen pixels are effectively darken or lighten. Using shaders isn't the unique way for a FOW effect, but I would go with it.
About the visible objects under the fog, that's up to your game logics to decide what objects are effectivelly drawn. The shader is only responsible for darkening more the area.

Hm, maybe this has a few tips ;)
You can search better about how to use shaders for lightening effects, many effects uses generated textures (simple arrays) or other input parameters.
Pluma - Plug-in Management Framework

julescoder

  • Newbie
  • *
  • Posts: 7
    • View Profile
SFML Lights
« Reply #4 on: February 22, 2010, 04:28:03 pm »
Thanx, u have given me an idea about shaders. I will look into GLSL furhter.

 

anything