libgdx / box2dlights

Fork of box2dlights by Kalle Hamalainen
Apache License 2.0
256 stars 81 forks source link

Set Falloff of lights #42

Closed haimat closed 9 years ago

haimat commented 9 years ago

it would be really great if one could set the falloff value of a light source. What I want to achieve is a very bright light, but with basically (very low) distance. Full brightness on one spot, no softness whatsoever. But only for some lights.

Would that be easy to implement?

rinold commented 9 years ago

For what it should be used? I mean if this will not have to deal with things like shadows or complex lighting of the underlying environment, than I suppose not to complicate the things and use the simple small spot sprites instead, which as I think could produce the same effect but without thousands of useless checks and iterations in lighting engine :)

haimat commented 9 years ago

In such a case using just a sprite is not an issue. Think of a very dark scene (i.e. low ambient light), then without light source you would hardly see the sprite any more.

rinold commented 9 years ago

You can use following render scenario:

  1. Render light-affected scene elements
  2. Render lighting (rayHandler.render)
  3. Render light-not-affected elements (e.g. spot sprites, UI, other things)

In that case everything rendered at point 3 will not be covered by ambient light.

haimat commented 9 years ago

Yes, I guess hat is correct. I will think about that solution, thanks!

haimat commented 9 years ago

Well, there is one problem with this approach: I need to render various elements in a certain order. When I would now render thos not-light-affected sprites after the rayHandler, then those will always be on top of eveything else. That is not really the expected behaviour :-(

rinold commented 9 years ago

Well, the lights are rendered in one pass also and they are also on top of everything rendered before. There is a problem anyway :(

haimat commented 9 years ago

True, it's a tricky thing... Well, nevermind, it's not that important. The pseudo-3d feature is what I am really looking for :-)