Point Light vs a single MC sample

Started by
3 comments, last by jameszhao00 11 years, 12 months ago
I'm trying to implement a path tracer at the moment, and writing out the formula for a point light gives me

(area of cos(theta)*sin(theta) in the hemisphere) * normalized lambert * cos(theta)

or

pi * L/pi * cos(theta)

However, writing out a single Monte Carlo sample gives me

(area of integration) * 1 / (Number of samples) * normalized lambert * cos(theta)

(2 * pi) * 1/1 * L/pi * cos(theta)



How come they aren't equal? I'm definitely misunderstanding something. Is integrating using a single MC sample not the same as using a point light?
Advertisement
Monte carlo is just a sampling scheme and just controls 'where you look' for lighting information. If you happen to randomly 'hit' the point that the light's coming from, that's great and you're equivalent. More problematic, however, is when your 'where you look' vector misses the point light outright and thus ignores its contribution. They control two entirely unrelated (well, at least from where you're asking) things.

EDIT: Think of the lighting information as a cubemap, if that's helpful for you. MCI is going to pick a bunch of random pixels in that to combine and get a final approximation to the lighting for the point in question.

EDIT 2: Oh, I think I see a little better now. You appear to be integrating over the entire sphere instead of just the hemisphere for equation #2. Change that, and bam, equivalent.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
For the 2nd part, 2pi is the area (sin(theta) dTheta dPhi) of integration for the hemisphere (sphere is [color=#000000][font=sans-serif]

4pi[/font]).

Thank you for your answer. I think I have a better intuition now.

They shouldn't be the same as MC with 1 sample is not going to give you a close answer, ever, unless the integrand is constant. With a point light, the integrand is nowhere near costant. So that establishes that those 2 shouldn't be equal.

Now just need to get some intuition on why it's 2pi vs pi...

You seem to be misinterpreting what a Monte Carlo sample is. Think of it in terms of geometry. As your ray hits a diffuse surface, it will be randomly reflected in any given direction on the hemisphere centered on the surface normal using a diffuse BRDF (which has a constant PDF of 1 / 2pi). This is what Monte-Carlo does, it sends a ray on the diffuse surface and randomly reflects it. As you increase the number of samples and average their results, the resulting radiance converges towards the correct light contribution from the point light. If you just fire one sample, it may or may not sample the point light. It's random. Monte Carlo is a random process. Point light sampling skips the whole thing and gives you the correct result (calculated analytically) corresponding to an infinite amount of MC samples. However point light sampling ignores every contribution in the scene other than the point light, while Monte-Carlo handles them correctly, which is why photorealistic path tracing must use statistical techniques because unless you only have a single point light and one diffuse surface, your integral is not going to be computable analytically - it will be nonlinear with light rays bouncing around everywhere, randomly hitting lights and surfaces. It is possible to use both in a random process to accelerate convergence, by scaling their PDF's accordingly, but it gets nontrivial with more complicated distributions (this is the simplest one).

Basically Monte-Carlo allows you to approximate any given probability density function (i.e. the integral) by randomly sampling it from a random uniform variable. In the case of a diffuse surface, the PDF happens to be extremely simple (constant), which means the integral can be calculated analytically.

Frankly I never found those analytical ways of looking at it intuitive at all. I find it all makes much more sense by looking at it from a geometric point of view with a basic understanding of optics and probability.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Thank you for that explanation.

I think I'm getting a better intuition now. The point light formula with the 1/pi is essentially taking a full cosine weighted light integral, and then scaling that by cos(theta). The MC version is scaling each direction's contribution by cos(theta), and then averaging that.

I still gotta go reread the section about integrating punctual light sources in PBRT though. Still no intuition about the pi multiplier sad.png

Edit:
So pi is the total projected solid angle when integrating the hemisphere. That makes sense now.

This topic is closed to new replies.

Advertisement