Real world attenuation.

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi people. I'm trying simulation real world lights such as car lights but I'm having trouble determining what attenuation values will give me the best results. Are there any general equations for coming up with constant, linear and quadratic bast on size and voltage of a light? How do most people here come up with attenuations values?

Share on other sites
attenuation = 1/distance isnt it?

I'm just working on this myself!

ace

Share on other sites
attenuation = 1/(a*distance*distance + b*distance + c)

The question I have is how do I come up with a, b and c.

Share on other sites
Quote:
 Original post by Grasshopperattenuation = 1/(a*distance*distance + b*distance + c)The question I have is how do I come up with a, b and c.

I believe this equation is commonly used by general purpose graphics libraries because it allows the programmer to choose between linear and quadratic attenuation, or any combination of the two. The values of a, b and c will thus depend on how you want to model attenuation, which will in turn probably depend on what you're drawing and how you're drawing it.

In the real world, though, the light intensity at a point is inversely proportional to the square of the distance of the point from the light. That is, intensity = k/distance^2.

EDIT: Sorry, I think I misinterpreted your post. Putting it down to exam stress.

If you do want to work with the equation you mention, then the constants you choose will probably depend on your rendering methods. If you're using some HDR techniques, then you could try to approximate the properties of the lights in the real world. Otherwise, you'll have to work out whether quadratic attenuation is too fast a falloff, and whether linear attenuation is too slow, and find some combination of the two that works.

The constant c will allow you to approximate the attenuation types without having the intensity tending to infinity close to the light.

Personally, I give all lights a radius and intensity, and then use the equation

where SqrDistance(v1, v2) is the square of the distance between v1 and v2.

This gives quite pleasant results, and has the added advantage that you can cull all objects outside of the light's radius, since all points outside of the radius will receive no light (with the equation you're using, there isn't this cut off). Unfortunately, it's probably not easy to implement this using a fixed function pipeline.

Blah. Must be a record number of edits on this post. The number of stupid mistakes I made is amazing.

[Edited by - MumbleFuzz on June 16, 2005 10:41:03 AM]

Share on other sites
attenuation = 1/(a*distance^2 + b * distance + c)
at all. It's a cheap hack to give more control to lighting artists. If you use a point light, which again, is not real at all, then attenuation is
1/(4pi * distance^2)

However, if you truly want something physically based, then you'll have to implement area lights, where attenuation is calculated by finding the projected solid angle subtended by the light over the unit hemisphere.

Share on other sites
Thanks a lot for the feed back guys. I was exactly what I was looking for.

1. 1
2. 2
JoeJ
14
3. 3
4. 4
5. 5
frob
11

• 13
• 16
• 13
• 20
• 12
• Forum Statistics

• Total Topics
632178
• Total Posts
3004603

×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!