Community
Arnold for Maya Forum
Rendering with Arnold in Maya using the MtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question about MonteCarlo Path Tracing

4 REPLIES 4
Reply
Message 1 of 5
Francesco_Furneri
352 Views, 4 Replies

Question about MonteCarlo Path Tracing

Hello guys,

I hope some of you can answer my question.

At school I studied the different GI algorithms and I found them really interesting.
Nonetheless I have a question (mainly of theoretical nature) about the sampling method for indirect diffuse rays.

In the Radiosity Algorithm, at each step, we fire rays from each patch to sample the radiosity from the other patches. For this reason we have a SUM of the different lighting contributions.

In the Path Tracing Algorithm we use a MonteCarlo method which fires random samples from the single point to sample the scene. At the end the result is divided by the number of the fired samples. Thus it is an AVERAGE rather than sum like in the radiosity.

The question is: I can understand the sum in Radiosity but why use the average in Path Tracing and not simply the sum as in radiosity (that intuitively makes more sense to me, as they are elements to be summed)?

In the image we have 9 light rays and just 5 of the them contribute to the final pixel value but we divide by 9. Shouldn't the other rays be ignored rather than being considered in the average?


1644498935494.png

Hope that makes sense.

Thank you very much in advance,

Francesco.


Labels (3)
4 REPLIES 4
Message 2 of 5

(summation vs averaging).. because in (the original) Radiosity formulation we ain't really 'sampling'.. we're taking real values of an approximated discrete quantity.. while with path tracing we're taking discrete values approximatively around a real continuos quantity.

The latter is (stochastic) sampling and for that we wanna average our samples to better have the expected value close to the real one. The former is generally the 'finite element method'.. subdivide a large problem into smaller problems that summed up will return approximatively the original one.

Practically, in radiosity we discretize the space into smaller patches we consider with constant radiosity and we add all the remaining patches to each single ones because we computed their 'form factor' (visibility term here) which tells us numerically the ratio between local vs global (as per finite element method).. ie. how the local patches are seen from the global GI pov we're 'integrating'. Without the form factor (as it is in practice because the visibility term is generally a bottleneck..) we would actually have to sample (the patches) as we do for path tracing. The difference would still be that we'd discretize the hemisphere into a finite (small) number of directions (instead to choose many ones randomly), sum up all the patches we find over the ray and then yep, - average all the contributions.

Take care that the radiosity rate of change is considered to be constant over the patch.. and only because GI (diffuse reflection) effectively changes slowly and smoothly... not because we can numerically somehow approach the problem in that way... ie. it's an experimental observation that leads to a certain biased approximation. Instead Monte Carlo methods are purely numerical approaches around the real quantity.

So that's not really summation vs averaging the distinction here. But summation vs integration.
Radiosity uses summation while 'path tracing' uses integration.
Summation is the sum of small numbers of big quantities.
Integration is the sum of big numbers of small quantities.
Summation is a discrete sum where Integration is a continuous sum.

What you highlighted at the end is the pitfail of (unidirectional) path tracing. Because we are in a regime of randomness and we only shot rays forward .. what we hit is what we hit 🙂 that's why we barely can sample caustics for example.. ie. given a very small and bright area light and let's say a budget of 256 samples.. we may get back from sampling with just one sample from the light and maybe 255 that hit nothing... at that point even just summating the contribution would not repair from having shot 255 samples just for nothing, eventually to sum up individual samples like that in a randomn sim we would still need a visibility term.


Message 3 of 5

@Max Tarpini thank you very much for your precise explanation. That makes sense. thanks 🙂

Just a small thing that I'd still like to understand: let's consider a case where we have few samples. as extreme example, 2 samples hit a bright surface and 8 a black one giving ideally no light contribution. With integration the "black samples" in the average affect the result reducing the brightness of the final shaded pixel, while the summation would just ignored the black surfaces and sum just the bright ones.

Intuitively, I'd say that summation correctly ignores the black surfaces while It sounds strange to me to average on those samples that don't contribute.

I Hope I give you the idea of my doubt.

thank you very much,


Francesco.


Message 4 of 5

What you are illustrating are pathological cases for path tracing. Of course there averaging samples ain't working so well. But the solution is not to just deterministically sum up your samples.. because they have been taken randomly.. the two samples you have got back from your tracing are not the irradiance of the point.. but once averaged they are the estimated irradiance at the point.

Naively, let's say you have a surface and you put in front of that two light bulbs .. the irradiance at the surface is the summed up contribution of those two lights (...). But this works only if you know in advance you have two light bulbs in front of your surface 🙂

With path tracing you don't know that in advance.. you're kinda blind and trying to figure that out by tentatives. The more tentatives the more samples the more close your averaged expectation will be to the real thing.

Message 5 of 5

wow. thanks. that totally clarified my doubts.

thanks a lot 🙂


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums