light attenuation

Posts: 196
Joined: 2009.02
Post: #1
The current method I use for light attenuation produces a slightly abrupt transition between the central area of the light(with a brightness of 1.0) and the beginning of the falloff region which attenuates the light from 1.0 to the scene's ambient light.

Here's what I'm talking about:

[Image: lighting.jpg]

My code looks something like this:
typedef struct
     float falloff;
     float central_radius;    

float object_atten = 1.0 - (obj_dist_from_light - light->central_radius) / light->falloff;

I've tried several other similar methods I've found through google but they've all produced similar or worse results.

I'd really appreciate any suggestions.
Quote this message in a reply
Posts: 196
Joined: 2009.02
Post: #2
Anyone want to give it a try?
Quote this message in a reply
Posts: 320
Joined: 2003.06
Post: #3
I have come across this problem quite often, and have done a few things that usually help.

First have a look at this excellent article explaining various interpolation techniques:

Instead of having an area of flat white suddenly hitting a linear interpolation fade off, you could have the fade start slowly at the center and increase as you reach the edges. A higher power or sin curve might help.

Also adding some noise or complexity with the interaction between the light and the world can help. This may or may not be possible for your engine, but using perlin noise to add texture to the light, or adding as well as multiplying the light with the background but with different algorithms or textures may also be an option.

Chopper, iSight Screensavers, DuckDuckDuck:
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Transforming directional light to eye space in GLSL Coyote 4 9,417 Dec 8, 2009 03:16 PM
Last Post: Coyote
  OpenGL Blending for 2D Light Effects metacollin 10 18,503 Jun 6, 2009 12:51 AM
Last Post: NelsonMandella
  Point distance attenuation with OGL-extension - how? mcMike 6 8,315 May 21, 2008 10:58 PM
Last Post: mcMike
  2d light shadows KiroNeem 2 4,501 Sep 9, 2005 01:12 PM
Last Post: KiroNeem
  Vissible Light (Volumetric?) hangt5 6 5,901 Mar 28, 2005 02:25 PM
Last Post: OneSadCookie