Why L = (1/r²)cos(a)L' ? (forum still too empty) back

(L) [2006/09/01] [greenhybrid] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

I always asked my self: Why the hell is the light-intensity divided by the square of the distance towards the light source?


For a radius r<1, the formula for the distance attenuation gives a higher light intensity than at the luminaires position itself


Or has it something to do with the energy-distribution? (really gotta refresh my knowledge on that ... :/ )



btw. I solved that problem by adding one:   L = (1/(1+r²))cos(a)L'
_________________
[LINK http://greenhybrid.net/] | [LINK mailto:root@greenhybrid.net root@greenhybrid.net]
(L) [2006/09/01] [toxie] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

basically speaking: it's the same as if your listening to sound from a speaker: the volume decreases quadratically if you move away from the speakers, same with lightrays/photons.


this nasty formula results from the transformation of sampling the sphere of a point to be illuminated, to directly using lightsource-sampling (=area sampling).


the trick with the +1 is actually the same what opengl (and tons of other renderers) is doing, but BIASED!


what you can do about it: bound the term by some constant b (instead of adding 1 below) and sample the hemisphere to compensate for the discarded information (add "hemisphere-sampled-light minus b" to the overall result).
_________________
what do you expect to do if you don't know what to do when you've got nothing to do?
(L) [2006/09/01] [Lynx] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

Well, in reality there are no infinitely small light sources (or speakers)...but if there were, yes light (sound) would get infinitely strong the closer you get...


@toxi: hm that approach is surprisingly simple...seems i still need to learn a lot more. Is there somewhere a nice page/paper about that?

Sounds a bit easier than multiple importance sampling, and probably even more effective concerning bright spots on diffuse surfaces near area lights...i did add a lower limit on the PDF for my path tracer (=>bias) because getting rid of bright spots otherwise is close to impossible...
(L) [2006/09/02] [Lotuspec] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

This small idea just popped in my head:

You could also just check the (smallest?) distance to the lightsource and if its too small go for hemispherical sampling. Sounds simpler to me and as long as your lightsources aren't too big I think it should work OK.


Adding 'the discarded information' seems quiet complicated to me. What is the resulting pdf that you are using for your lightsource sampling for example? Your not using 1/Area anymore but something a whole lot more complicated that depends on the position you are shading.


EDIT:

Seems like I should have thought about it a little longer because its not as complicated as I thought (at least thats what I think for the moment  [SMILEY Razz]):

if your sampling a lightsource and the distance is too low: just return a 'zero outgoing radiance'

and

when sampling the (hemi)sphere only return 'non-zero outgoing radiance' if the distances is below the threshold.
(L) [2006/09/04] [toxie] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

The idea is from the paper by Keller and Kollig: Illumination in the Presence of Weak Singularities
_________________
what do you expect to do if you don't know what to do when you've got nothing to do?
(L) [2006/09/04] [Michael77] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

Thanks, I will have a look at it.
(L) [2006/09/06] [Lynx] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

@ toxi:

thanks for the hint, i even had a look at the paper before, but totally forgot about it because i was so busy with the basics of my renderer...

Still, i'm not sure if i understand this 100% correctly.


For an unbiased illumination by area lights i'd do two monte carlo integrations:

- a normal monte carlo integration with some term (here G) bounded by b

- to compensate, a second integration sampling from another distribution, weighting the samples with max(0, G-b)/G

and add both estimates of those integrals?

i.e. i'm free to choose how many samples i take for each integration?

So i still need to compute the light PDF for the extra samples, because G is, if i calculated correctly, A*cos(wi, N)/light_PDF, which also means, i should bound fr(...)/light_PDF by 1...or so...!?
(L) [2006/09/07] [Lynx] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

Hm okay, i've implemented it now, and after dozens of stupid mistakes, it seems i understood it correctly even [SMILEY Very Happy]

However, only taking as many extra samples from BSDF as samples from light had to be clipped actually makes results worse. While the bright spots obviously become less extreme, the areas where only few light samples get clipped become definitely more noisy (!), because of the horrible precision of the bias-compensation with such few samples it seems, i hoped that the chance those samples contribute very little is high enough to improve things on average. But even very close to the light things became not really much better. Maybe triggered by a much lower bound it would work.


Only taking about the same amount of samples for both integrals yields clean results it seems. If the number of samples is high enough, triggering sampling from BSDF when one sample has been clipped works reasonably well with moderate rendertime increase, and the worst thing that can happen is dark spots.

But i'm afraid for glossy BSDFs things are not quite as easy...the trigger maybe will rarely uhm...trigger [SMILEY Smile]

Guess those will get a "force MIS" indicator...will have to evaluate if this techique there works too, or if something like power heuristic performs better.


Some images (pretty boring though):

standard 49 samples from area light, unbiased:

[LINK http://lynx.aspect-design.de/yafray/areal_49s.png]

same settings using bounding and triggered bias compensation:

[LINK http://lynx.aspect-design.de/yafray/areal_49s_aws.png]

8AA samples * 64 light samples, as you can see, sampling from light still doesn't cut it despite a total of 512 samples!

[LINK http://lynx.aspect-design.de/yafray/areal_8x64s.png]

Again with bounding and bias compensation:

[LINK http://lynx.aspect-design.de/yafray/areal_8x64s_aws.png]


This is using QMC sampling for everything btw, with all samples from continuous scrambled Halton sequences (from yet another Keller paper...)
(L) [2006/09/08] [playmesumch00ns] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

Nice results lynx. Tho what's that black line on the lit side of the box? Shadow ray epsilon error?


Could you explain your method in more detail for those of us who aren't quite keeping up [SMILEY Smile]
(L) [2006/09/08] [Lotuspec] [Why L = (1/r²)cos(a)L' ? (forum still too empty)] Wayback!

I am curious how this compares to standard MIS (i.e. sampling from arealight and hemisphere combined using balance heuristic or power heuristic with power 2).

back