TU Wien Rendering #11 - Recursion and Heckbert's Taxonomy

How ray tracers spawn secondary rays for reflections and refractions, weighted by Fresnel coefficients. Classic recursive tracers handle many specular bounces but struggle with diffuse ones. Heckbert's notation classifies light paths and maps them to different rendering algorithms.
Chapters
Now let's jump back to recursion. So if I would like to compute multiple bounces, I need to handle this somehow. And we have talked about this briefly, if I intersect the first object, I need to reflect the ray off of this object in some way. And after the shading is done, diffuse specular ambient shading, then we can trace the light further. And this tracing step can be both reflection and refraction. You remember Fresnel's law and Snell's law. We are going to put them in use in a second. But what I need to tell you is something super weird, but you won't feel why this is weird. So in a ray tracer, in a recursive ray tracer, not global illumination, with the indirect illumination and these goodies that we're going to start next lecture. In a raytracer, if you encounter a mirror, an ideal specular reflector, you will bounce the ray back in the ideal reflection direction. So exactly what you would see in the mirror, if it's 45 degrees, it is 45 degrees back. And you do the same with diffuse surfaces as well. So you continue the ray in ideal reflection direction. And now this sounds reasonably ok, but when you will study global illumination and how the whole thing is done, how real men compute the rendering equation and images, you will see that this is a super, super huge simplification. I remember the faces of students when they think back, when they know all about global illumination and we talk about simple recursive ray tracing. And I asked them, how is this reflected? And there is silence because they will know that in global illumination, it's going to be so natural that the diffuse surface means that it will reflect light in every direction with the very same probability. So the perfect reflection direction has the same probability as coming back the same direction where it entered the surface. They all have the same probability, all directions. And then suddenly a ray tracer says that even a diffuse object I'm going to treat as a mirror. So this is going to be super weird. And please remember when I say this later on, if you take a look at ray tracers after global illumination. Now, how does the recursion work? I hit something, I reflect the ray for a ray tracer, always the perfect reflection direction. And I'm going to restart the whole process. I'm going to start to TR a new ray that starts on the object. Remember, this is when you get the self intersection T equals 0. I increment this maximum ray depth value to show how many bounces I have computed so far. And I Start again. So I start a new ray. I imagine that this object is now the camera and this is where the ray is starting from. Is there a question or. Okay, so we got everything. How does it look like in terms of mathematics? This is the illumination equation without recursion. But now I need to add one more term. Let's quickly recap this. The first term is the ambient term. This is to warm up the completely black shadows. This is basically a bunch of hacks, but it looks good. So we are going to be okay with this for now. Then we scale the amount of incoming light with the material properties. So a diffuse and a specular shading model. These are weighted by KD and ks. These are values that tell you how diffuse or how specular this object is. And not only how specular it is, but what colors does it absorb? What colors does it absorb? Reflect. So what is the color of the object? What is the diffuse and specular albedo of the object? I'm using so many terms not because I'm inconsistent, but because people use all of these terms and therefore you should be familiar with this. And there's some weird stuff that I now added. And this is the recursion part. So KT is the Fresnel transmission coefficient. This is the probability of refraction. Because you remember that I hit this airglass interface from different directions. And if I hit them from different directions, then the probability of reflection and refraction is different. So depending on the incoming direction you have seen, this laser is stronger in one direction than the other. And we have to account for this with these transmission coefficients. And the it is the intensity that is coming from that direction. The KR and IR are the other way around. So if there is reflection, not refraction, then I'm going to go in that direction and I'm going to scale this with the intensity of the incoming light from the reflection direction. A quick example. What if I have a glass that's blue, so some kind of glass that looks almost entirely blue. Then this Fresnel transmission coefficient is going to describe a color that's bluish. Therefore, all the energy that comes through this ball is going to be colored to blue. And the Fresnel reflection coefficient can be whatever. So we are now interested in. So this is how I can define materials like that. This is the recursion part. And for this I need to start perhaps multiple rays. So if I hit this object and I say that, hey, but this is a transmissive object, this is glass, what do I do? Because there is a probability a Positive probability, usually for reflection and refraction. Do I start two recursions? Do I start two new rays? What do I do exactly? And in the assignment that I'm going to talk about, you will see a piece of code that does something and then you will see the effect of something. I'm not going to spoil anything. And just a quick introduction to Heckbirds notation. This is important because if you know this kind of notation, then you will be able to discuss what kind of ray tracing algorithm can render what kind of light paths. So as a status quo, all light paths go between light sources and the eye. If it doesn't hit the lens of the camera, it's not going to be recorded in the image. So every light source is, every light path is going to be written as l something, something, E or as. This is bidirectional. You can imagine the other way around. So you can say E something, something, L. D denotes one diffuse interreflection during the way, S is one specular interreflection during the way. And the asterisk means any amount of diffuse bounces, perhaps even zero. So LDE means that either I hit the eye from the light immediately or there is one diffuse bounce, or maybe an arbitrary number of diffuse bounces. This is what the asterisk tells you. And we can also denote the choice. The choice means that there is only one either specular or one diffuse bounce. And with this small but powerful notation, we can discuss all the algorithms there are to render photorealistic quality images. So for now, some of this will be intuitive, some of this will be not so intuitive because we don't know global illumination yet. But first, ray casting means that we hit at most one diffuse object. That's all it can render, no recursion, nothing. I just hit one diffuse object, I do the diffuse shading and goodbye radiosity can compute something like indirect illumination because multiple diffuse bounces are possible. So remember the example, the light comes in to the classroom through the window, hits the white wall and then hits the umbrella and therefore the umbra is not going to be perfectly black. This is called indirect illumination radiosity. Scott, that covered recursive ray tracing. What we are doing with this Fresnel transmission and reflection thing, we know that what we can do is indirect illumination. Definitely not. Because we treat a diffuse object also as a mirror, we just use a different shading function for it. So we don't trace rays all along the hemisphere of the object because it collects light from every direction. This is why it doesn't change if I move My head. This is why the sight of it doesn't change. But we cannot account for that. This would be a huge dimensional integration problem that we're going to solve in the rendering equation. So at most one diffuse bounds. But you may have as many specular bounces as you need. So this is why recursive ray tracers usually show you mirrors and glass balls and reflective things like that, because it is capable of rendering it, but not so much more. And global illumination, that's the full package. An arbitrary number of diffuse or specular bounces. This can also be glossy. Whatever kind of complicated material model you have here. This DS can be anything and in any amount. Well, let's take a look at an example with the Hagberg notation. So here we have light paths, and they start out from the light source. So on the right I have something like ldde. That's exactly what I have been talking about. So I start from the light source, I hit a diffuse wall, I hit the diffuse ground, and then I hit the camera afterwards. So that's ldd. Let's take a look at, for instance, lsse. So I start from the light source, I hit the glass ball from the outside, this left glass ball, and then I go inside the ball. There's going to be refraction. At least let's imagine that there's going to be a refraction and then I hit it on the other side as well, and I come out. So this is two specular bounces, lss. So we can denote live paths and understand what algorithms can render what exactly. So here, if we imagine that this is a ray tracer, this is an image with a ray tracer. The question is, what did they do? This is a rather low quality image, but it seems to me that the shadows are not completely black. Therefore, in their shading models, they definitely use the what kind of term? Raise your hand if you know the answer. Okay, that's still not too many. So normally this would be completely black because I shoot a shadow ray towards the light source and it is going to be occluded by the table. So intensity, zero, zero. Imagine that like all possible shadow rays are blocked, but this is still not completely black because I'm adding a term to it in order to warm it up and make the image a bit more realistic. So this would be which term? Ambient. This would be the ambient term. Excellent.










