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

Author Topic: Lights  (Read 1630 times)

0 Members and 1 Guest are viewing this topic.

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Lights
« on: May 02, 2012, 01:08:09 am »
Hi,

For my game I need a few lights. Not a full light system with wall detection, etc.. No, just some points that "glow".

I found two solutions to do it, but I don't know wich is the best :

1) I just use a sf::CircleShape with a texture of a circular gradient from white to black (transparent), I can use setColor to color it and I draw it each frame with an additive blend mode => simple

2) I use a class to store a vextex array of triangles, my color, my position etc... I calculate the color of each verticle before to add them in the array. I can draw the vextex array with additive blend mode (inspired from Gregouar light system). I haven't tested this solution yet

As it is for a very simple light system, I'm tempted by the first solution, however I wonder if there are any advice or warnings about each solution (like the rendering speed, ...) ?

I haven't spoken about shaders because I can't figure how the hell they work :p

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Lights
« Reply #1 on: May 02, 2012, 02:07:41 am »
Ok i've chosen the second solution in case I've to reuse it, it is more parametrable.

Furthermore, it's more realistic ^^