Followers 0

# Distance squared light falloff

## 9 posts in this topic

For the solar panel one, i guess at distance 0, the area of the solar panel there would be very close to 0 too, canceling it out.

0

##### Share on other sites

Here you are mixing up relative and absolute measurements. You quoted "doubling the distance cuts the intensity by four"... now how do you go from doubling the distance to "2 feet"? Or more specifically, which distance did you double?

Doubling the distance would mean to go from 1 foot to 2 or from 0.3m to 0.6m in both cases you doubled the distance and quartered the intensity...

Yes, this.  Your falloff factors are relative to a distance of 1 in each of your respective units, so relative to 1 meter, a factor of 2.69 is correct - because the light at 0.6096 meters will be that much brighter than the light at 1 meter.  Important to keep your units consistent.

In this case, to do an equal comparison you need to use the falloff at 0.3048 meters (1 foot) and compare to the light at 0.6096 meters (2 feet) - that gives us 10.7639 and 2.6909, and what do we get if we divide the former by the latter - 4.

1

##### Share on other sites

Point emitters are just a theoretical non physical thing. It's just used because hey, it looks good and close enough to physical that who cares right? There is no real world analogue to an infinitely small point light of course, quantization as photons blah blah blah. It's a useful hack and that's that. And importantly its the fastest useful hack you can do, at least for getting close. And it should still be energy preserving, after all the closer you are the the infinitely small point source the smaller the area being affected. At zero, the point source, you've infinite energy and zero area to fall on so congratulations!

I guess if you really wanted to, and why wouldn't you? You'd use the blogs thing and estimate the actual area of the light source for everything. The area being the coil inside the lightbulb, or maybe the area of the reflector on a flashlight if you want to get all that light in there. I.E. choose your convenient light diffuser/reflector. More accurate light falloff for real cheap, sounds good to me; even if most light sources we actually have are extremely small (which is why point light sources work so well as an analogue) there's still other things that will reflect them in a static fashion/diffuse the light to the point that an area light source such as the blog's would be more correct.

Edited by Frenetic Pony
0

##### Share on other sites
Even if it's not right I use 1 / (1 + d^2) it's cheaper than 1 / (1+d)^2 and nicely avoid infinite problem. For pc game I would use area lights for everything but it's just not feasible on mobiles yet. Edited by kalle_h
0

##### Share on other sites

Ad infinite problem, maybe this is absolutely obvious and I'm just spamming, but from what I remember, the number of photons is, by all means, finite (and can be computed). Therefore you can't recieve infinite energy near the light.

F.e. for 40W cool white fluorescent bulb it should be around 2.55 X 10^19 photons radiated per second (counting effectivity in - it can be derived from energy of single photon E=hf=h * c / lambda, average wavelength for light = 600 nm, energy = 40W ~ 40J (assuming we radiate the light for 1 s), with this value divide the actual energy radiated by the bulb (of course after application of efficiency which should be just several percent)).

0

##### Share on other sites

It's just used because hey, it looks good and close enough to physical that who cares right?

It's used because it's trivial to analytically integrate a punctual light source with any BRDF, which isn't true of area lights.

0

##### Share on other sites

One measures the distance as being 2 feet, and calculates a falloff factor of 1/4.
The other measures the distance as being 0.6096m, and calculates a falloff factor of 2.69.

Here you are mixing up relative and absolute measurements. You quoted "doubling the distance cuts the intensity by four"... now how do you go from doubling the distance to "2 feet"? Or more specifically, which distance did you double?
Doubling the distance would mean to go from 1 foot to 2 or from 0.3m to 0.6m in both cases you doubled the distance and quartered the intensity...

That example only contains absolute measurements. The "doubling the distance" bit was mentioned earlier, the way I've heard photographers explain 1/d2. This example only contains absolute d values being plugged into 1/d2.

Your falloff factors are relative to a distance of 1 in each of your respective units

Ah that makes sense! So when games use code like:

output = dot(n,l) * 1/(d*d) * intensity

then intensity is the value that you want the light to have at one unit from the centre... pretty obvious once I say it, since that's what happens.

And with the blog's formula, you're not setting intensity at 1 unit, you're setting intensity at the surface of the emitter. So the two formulas are give multipliers that should be used against different initial intensity values.

I guess seeing that the above code doesn't take steradians or areas into account anywhere, we're using some kind of assumption that all of our calculations are being done for some small-steradian-subtending small-area, which is the same for every one of our pixels? So if our game uses metres for everything, our light intensity value is in "light-units per small-area-at-1m-distance"?

If you bring the light 2x closer, it will get 4 times brighter, and with it being a point there's no limit to the number of times you can do this... so:

Also notice that while moving arbitrarily close to a theoretical point light source the energy doesn't go to infinity, the energy density does..

Thanks! So even if the light emits a quantifiable pulse of 100 photons, then at the moment of emission, there's always only 100 of them... but if your receiver was at the same point, with zero area, then we'd say there was 100 photons being received in zero area, which gives us a reading of infinity photons per m2!

In games, using the above code snippet as an example, we pretty much never take the receivers area into account (except for the N.L term). If we accounted for the actual world-size of the pixels that we're shading, and the solid angles that they subtend, would this cancel out the wackyness caused by the fact that the energy density approaches infinity? i.e. in order to measure that infinite energy density, our receiver have to have zero area, so you'd end up with something that's wacky in a different way, like ? Or we'd have a rectangular receiver area with most of it having zero energy and a single point on it's surface having infinite?

this formula doesn't work when the radius of the emitter is zero, so I'm still left puzzled about how to reconcile point emitters with spherical emitters. These two variants (1/d2 and 1/(d/r+1)2) give different answers

I figured this one out myself - it is possible to reconcile the two formulas:
In the formula from the linked blog, d is the distance from the outside of the emitting sphere to the receiver, and r is the sphere's radius. We can rearrange the blog's formula like so:

Importantly, d+r is the distance from the centre to the receiver, which is what the typical 1/d2 formula uses. So if we let D=d+r, and try and find an equivalnce with the typical formula, we get:

So, our typical 1/d2 formula is actually true for a sphere with radius of 1 unit (so again, your 'light intensity' game values are relative to 1 of your distance units). I guess this also implies you shouldn't trust it's answers for values of D that are smaller than 1, because such a situation should be unpossible, although the math does hold up until D hits zero

I'm still confused about the differences that occur depending on whether we treat our receiver as a spherical cap vs a rectangle though (with the 1/d^2 law being right for the spherical cap). Is this always the most appropriate geometrical approximation to be using?

Edited by Hodgman
2

##### Share on other sites

How about r^2 / (max(d,0) + r)^2 to fix infinity problem?

0

## Create an account

Register a new account