#### Archived

This topic is now archived and is closed to further replies.

# Light Model

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

## Recommended Posts

I was wondering - how is the falloff of light measured ? When looking at an object a certain distance away, is its apparent brightness a linear function of the distance, a square function, or what ? I''ve seen both used in places, so which is the more correct method ? Much obliged. r. "The mere thought hadn''t even begun to speculate about the slightest possibility of traversing the eternal wasteland that is my mind..."

##### Share on other sites
Neither!

Most lighting models in computer graphics are hacks from the 1970''s which "kind of look right" and are cheap enough to do in realtime. Common graphics APIs often use something along the lines of:

Attenuation = 1/(a0 + a1*d + a2*d²)

Where a0, a1 and a2 are coefficients which describe the falloff curve. You could use other parametric curves to describe the same/more complex falloff.

The exact values for a0,a1 and a2 depend on what exactly the source of the light is and whether it has a lampshade on etc (AFAIK a real world light falls off a lot earlier than a theoretical physically pure one!). Generally for this stuff most people just let an artist play with the values in their 3D content creation package (Max etc) until they get something which "looks" right.

For more accurate modelling of the light you have to start thinking in terms of radiation being reflected and absorbed by surfaces in the scene (i.e. much of the diffuse light you usually see in a room hasn''t come directly from the lightsource, its bounced off something first). See "Radiosity" for more.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

##### Share on other sites
Thanks. Ok now another light question: what makes light falloff occur? What is the difference between haze, mist and fog ? Why do things further away appear less bright ? What is the meaning of life ?

Ok maybe not that last one
r.

"The mere thought hadn''t even begun to speculate about the slightest possibility of traversing the eternal wasteland that is my mind..."

##### Share on other sites
Well, here's a conservation of energy argument. It's only a subset of what's really going on.

Any source of light is really a radiation emitter. If you are emitting some amount of radiation in all directions, then this amount of radiation is effectively distributed across the surface of a sphere. The sphere gets larger as the radiation travels away from the emitter. The total amount of energy 'on' the sphere remains constant. As the sphere gets larger, the amount of radiation present in a constant-sized area (say, the size of your camera lens) will decrease. So if I moved a camera back along the expanding wavefront of light (I'd have to move at c!), the amount of light 'entering' my lens will decrease as I move.

Thus, lights far way are dimmer than equilvalently energetic lights nearby.

Edited by - cheesegrater on August 1, 2001 4:31:47 PM

##### Share on other sites
I like the sphere explanation CheeseGrater, that was good.

If you continue to think of light as moving outward in an ever-expanding sphere, then you can use some geometry to come up with the falloff of a "perfect" light.

area = 4 * PI * radius2

Since you're going to be multiplying this by the intensity of your light, light falloff is going to be:

intensity * 4 * PI * radius2

Since we're really only trying to find a relationship between distance and intensity, the equation is really a proportion, in which case there's no need for the "4 * PI" part," and you can replace "radius" with "distance," so you can simplify it and it becomes:

intensity * distance2

But that's in a vacuum. Light traveling through air is scattered, reflected in different directions, and, in general, loses some of it's intensity as it moves away from the light source. But since the behavior of light in air is so close to its behavior in a vacuum, I don't think it's worth approximating that anyway. But if you want to, then here's what I thought of. It could very well be wrong! For each unit of distance, there is a small amount of light that is absorbed or reflected away from the target by particulates. That means that, for a given distance, we want the light value to be equal to the value of that distance and all previous ones. Now, if this distance were subdivided into infinitely small sections, then the amount of light bsorbed would be infinite, and the object would receive no illumination. This obviously is not how things work. There is, however, a formula for finding the sum of all positive integers less than or equal to x. That formula is (x * (x + 1))/2, and, when graphed, it created a parabolic curve which can be approximated simply with x2. In order to take into account the amount of light that you want to be absorbed, you'd have to change that to (x * absorbtion_factor)2, where absorption_factor would represent the amount of particulates in the atmosphere. If you combine that with the "vacuum formula," substitution distance for x, you get this:

intensity * distance2 - (distance * absorbtion_factor)2

But, if you're interested in radiosity (if you're using it for a game, use it to precompute your lightmaps; it's not gonna happen in real-time!!!) then check out this URL: http://freespace.virgin.net/hugo.elias/radiosity/radiosity.htm . It is the best explanation of radiosity I've ever read. By the way, the article on radiosity here at gamedev.net explains a - err - bad way to impliment it in a game, and never even explains how radiosity values are calculated. So ignore it!

Edited by - TerranFury on August 5, 2001 5:33:32 PM

1. 1
Rutin
19
2. 2
3. 3
JoeJ
15
4. 4
5. 5

• 22
• 19
• 11
• 13
• 17
• ### Forum Statistics

• Total Topics
631698
• Total Posts
3001768
×

## 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!