 Quick question, we really discussed the rational plan that we were done. When do we start tracing the array? Well, what we did so far is we did a product, so we said that there's a maximum number of bounces that I'm going to compute and the rest of it I'm not interested in. The problem is that this is a biased solution and we are missing some energy in the image, because if I didn't compute many more subsequent bounces, I would accumulate more radiance, so I would get perhaps a brighter but more faithful in this to reality. We can do much better than that. Once more, there is a technique that can compute an infinite amount of samples, an infinite amount of depth, and that boggles the mind, because what is really happening, if I want to be able to compute physical reality, I would need to have a maximum depth of infinity. I couldn't even compute one sample of the pixel, because I would have to bounce the array indefinitely. But there's an mathematical technique that can keep you, the results, as if you computed an infinite number of bounces. And this is against the statistics and probability, which is usually very difficult to wrap once mind around what is happening, but we can actually solve this problem. So how can we overcome this? What we're looking for is an estimator that converges to the expected value of integral. Okay, that's fine, that's fine. I'm looking for the expected value parts. Having the expected value, or looking for the expected value or something is one thing, but there's not only expected value that is variance. So I may have multiple estimators, and what I'm looking for is one that has the lowest possible variance. What I can do here is, after each step, by step, I need each bounce, I decide whether I will terminate the path, so I would stop this like that, or I would continue. But if I continue, I multiply the collected radiance with the sun then, and the question is what should this happen? Now, this, I would like to relate to, for instance, Fredel's law. In Fredel's law, we could compute what is the probability of reflection, and what is the probability of reflection? Like here, the last window, and with some probability, I will continue to migrate through the window, and with some probability, I will get a very effective. Now, what I can do is, I can run many samples, and add that together, or what I can also do is, that I don't run many samples, I enter the window, and I compute that there's an 80% chance of reflection, and 20% for reflection. And I will send out only one ray in each direction, but I would multiply this by relative probability of the effect. So I'm not tracing 10,000 rays, I will send out one, and I will multiply it by 0.8 in one direction, and 0.2 in another direction. And then, if I will do this, yes, I will compute more and more samples, but statistically, this is sound, so what this means, is that this converges to the expected value of the integral. And rational that does the exact same thing, but it gives you an infinite number of boxes. So, with a given probability, I stopped, and with a given probability, I continue, but I will multiply the collected variance with a factor. And this factor for the front-end, is an example of the probability of reflection. What does the algorithm look like? I choose a random variable, let's call it xe, on 0,1. And with a given probability that's pi, I continue the light path after hitting something every round, and it flow a dice. And if I have this probability, I will continue my light path, but I will multiply the collected variance with something. And what gives you the end results, as what you would see in the textbook, I'll try to show you the gross process on from how someone can put together. I will need to multiply it by something, I don't know what this something should be. We will find out together. And if I don't hit this probability, then I will terminate the light path, so we could imagine this as if I continue the light path, but I will multiply all the results even for gradient, pi, 0. I spoiled 0 for the second question, so that's a damage, but you would have found this out in a second anyway. So I'm looking for an expected value of something, that l i in the hat is an estimation, an estimator. And on the right side, this is the actual L i. So whatever happens in the middle is some magic, but the constraint is that the expected value of the estimator should be the same as the origin of what it is in the line of the input. There is a probability of continuation, and if I don't hit this probability, then I will stop. The stopping part is trivial, if I stop, then I will multiply this term with 0. So imagine that I continue my light path, I won't be the wasted time until infinity, but it will be the pi 0. Now the question is, what is the other question mark? What I know is that on the right side, I would want to get l i. So forget this right term, what do I need to do with this expression on the left in order to get l i to the wrong side? Raise your hand if you know the answer. I want you to take a few seconds and think about it. What do I need to do to get l i from this expression? The rest is multiplied by 0, so this doesn't matter. Raise your hand if you know. Maybe, maybe. Yes, please. Yes, I have an answer. Asked if you were OK. I think that l i multiplied by 0. Yes. It was that. I killed the pi because I don't see an epi here. So there is going to be a fraction, and the denominator is going to be pi. So I killed this guy, but there is no one in there, and I want someone in there, and that someone is the l i. So I killed the pi with my fraction, and in the numerator there is going to be l i. So if I do this, then what I am doing is going to be statistically solved. And I try to give you the intuition again. This takes time to wrap your head around. It is almost like in the front-out equation that what you could do is you could send out one ray in one direction. So you could send out 800 rays in one direction and sum them up. What you could do is that I sent out only one ray, and I multiply it with 800. And no, I would not get the same result, but I would get the same expected value. And over time, the variance around this expected value would shrink if I do this many times. So this is the intuition behind the whole thing. What is the good choice for the pi? Because this has been a parameter so far. What should I put in there? Well, with a little fraction, I could say it doesn't matter. You could put many sensible choices in there, and it would work. But quickly, let's review the cases where it would not work. Well, obviously, there are two very stupid options. If you put pi or zero, then this would mean that you would never continue your path. You would always stop. So this is obviously great. What if I say pi equals one? Well, this means that I would always continue. I would never stop. Well, you can say that the mathematically this is sound, but you could never compute one sound or two pixel. If you're on that condition, you would say I have a theory machine that you never stop. It doesn't make too much sense if you're looking for practical solution. Now, anything that it may mean the two is completely fine. The only difference is, because I've showed you that the expected value is the same as the actual quantity done. That I'm looking for. But the variance is different. So it is oscillating around the very same number, but the magnitude of the oscillation depends on this choice. And what you can prove, but it is actually very easy to visualize that the good choice for the PI would usually be something that would sample brighter paths, longer, and darker paths I would want to terminate faster. Because this is the same as matching the green function with the blue function with the green bars. I would want to reconstruct the brighter regions more faithfully than darker regions. Because this is what this means, smaller error. So what you can plug in there is plenty of the elevator of the material. So if you have a really bright, wide wall, then you would be the super high-quality if you would want to continue up. But if you have a really dark object like the curtains, you either side of the room, you would want to stop with a much larger probability. So this is how Russian will work. We will also code this. So in the next lecture, you will see the whole thing that we studied in code.