TU Wien Rendering #13 - Easter, BRDF++, Depth of Field

LARRUZ covers Oren-Nayar and Cook-Torrance BRDFs, multilayer models for car paint, and how to simulate depth of field in a ray tracer by sampling through a focal point. The lecture explains why ray bounces grow exponentially and how aperture size affects convergence in global illumination.
Chapters
How was the Easter break? Nice. Too short. Come on, we discussed this already. But what would be an appropriate length for you? 52 weeks. 52 weeks. Okay. Maybe the entire curriculum. Yes. And just extend it every time then. So every time by just two more weeks or something like this. Yeah. Well, I don't know about Austria, but in Hungary, people usually go to their friends. You know, many people are coming over and we are hanging out with other people, and you always have to drink their stuff. So you go there and we have this drink that's called the palinka. It's something like the schnapps, but way stronger. And I told this to some. Some Austrian people, and they were like, oh, my God, stronger than the schnapps. How can that be? And it's very easy, at least in Hungary. So that's how it works. And you. You go to the. To the very first place, and you have to drink from their homebrew. Awful palinka. Usually it's very awful. And. And you even have to say something good about it. So you drink it and it's like, oh, but you have to say something good about this because they are looking at you. What will be the reaction? So you say that that's really strong. And then most people seem to be satisfied with that. So this is usually what I say. But then when you are at, like, the fifth station for that day, and some people just don't take no for an answer, unfortunately. So this is how it goes. Is it any better in Austria? It's more a family holiday. Yeah, the family part is actually the nice part. So we can decide if we drink our own stuff or not. I mean, my fiance's grandfather attempted to make some brew, some falinko at home, and, well, he did something. So, I mean, something was created in the process, but after tasting it, even the postman didn't want to drink it. I don't know about postmen in Austria, but in Hungary, they are like really hardy people. So they drink whatever they find because obviously you don't give the good stuff for the postman. You give them the leftovers. It's like no one drank, oh, it will be good for the postman. And he's happy with that. Imagine that. Kind of unusual here. Yeah. Yeah. Well, they are. They seem to like alcohol, according to my experiences. So. Yeah. And even the postman didn't want to drink that anymore. So next time we have seen him around the house, and he just came, like, in front of the main, and we waved to him that, hey, come, we have some for you. And he was like, no, I'm just gonna put them in here immediately. Okay, so regarding the assignments, you guys and girls have done really well. So I'm very happy to see that people realize that there is some exponentiality with respect to the depth of the simulation. So the more deep we go, then the more exponential things become. But this is after like. I mean it's exponential all along, but you don't notice because it starts off slow. But after like 10 to 15 bounces, you can see a very telling characteristic of this exponential distribution. And many of you have recognized correctly that this is because refraction and reflection are sampled on the time. So whenever I have a bounce, I am going to compute an intersection and then there's going to be two rays perhaps that continue their wave because one is going to be in the reflection direction and one is with refraction. And this quickly gets out of hand because for every ray you have two more. That's the definition of something exponential. So well done. Let's proceed a bit. I'm going to talk just a bit about some advanced, a bit more advanced BRDF models that are mostly used with ray tracing. So you remember this Lambertian BRDF that you see on the right and this is the scalar product between L and M, so the light vector and the normal. And obviously you can scale this with kd, which is some kind of diffuser. We do. Now if you put it next to a real image of a diffuse material, obviously it is a question, you know, what do we call a diffuse material? Or where was this photograph? How exactly? But let's disregard this and let's accept that we have this difference between the two. And if you take a good look, then it becomes apparent that in grazing angles the simulated diffuse material seems to be completely torn. And if you take a look at the formula up there, then this is self explanatory because the normal and the light direction and the normal and the light direction can get perpendicular and then you will see this darkness. So there are some advanced PRDF models that try to be a bit more realistic in this regard. Such example is the Oren Nayer model, which is much closer to what you would measure in real life. But let's note that all of these simplified VRDF models, these are all tags. This is not what physical reality is. People write up the actual equations that relate to physical reality and try to simplify in a way that a simple ray tracer can capture. We are going to talk about global effects and what a real diffuse material looks like in a few minutes. So this RNA model seems much better. And what's even more, it can take into consideration these Microsoftic imperfections in different materials and you can get a roughness parameter that can model these imperfections. What about specular models? Well, the FUNC model with V dot R that we have talked about is not the only way to do it. There is also the Phong Blin model which is a more advanced model and uses this H, this half vector between L and V and it produces different results. I think this image is maybe not the best because yes, the highlights are different. But one of the main advantages of this material model is that the shape of the specular reflections can get a bit more elliptic depending on the viewing direction and the surroundings. So here you have the very same circular thing. So it's not the best example, but you can see that it's different, it looks more realistic. And we still have to think about the fact that these are still really good models, that these are still. There's also the Cook Torrens model that's basically Fong Blinn that can model also microscopic roughness. And here maybe with the projector, maybe it's not so visible, but you can see that specular reflection here is a bit more easier. So it's not a completely round sphere, it's not a perfect sphere. There are these spheres, small imperfections that are characteristic to real world materials. So this is what this model can capture. And there are some other advanced BRDF models, some of which are more easy to understand and implement than it is to pronounce the name of the authors of the BRDF models. This is one of those examples and this is some kind of a multilayer model where you have a diffuse substrate and, and you have like a coating, specular coating. So There are also BRDFs for car paint where you can have these sparkly effects. And there are many BRDF models that capture given effects. Okay, what if one would like to play with this? The Disney guys have implemented this program called the BRDF Explorer and you can load many local BRDF models and change the light source positions. Look at the actual BRDFs and impulse responses. Give it a try. So we have always been talking about cameras, so we are trying to model real world cameras. If you have a handheld camera, you will see a setting that's called the F stop and the F stop is related to the size of the aperture. The aperture is the opening of the camera where the light goes in. And you can set this to different values and you will notice that if you set this F stop to a high value, then the aperture of the camera is going to become smaller. And if it's smaller, then this means that less light is let in and more of the image that you get is going to be in focus and vice versa. So if you have a low F stop setting, then you will have a bigger aperture, more light is let in, and more regions will be out of focus. And this is what gives you this depth of field effect, because whatever images we have seen and created with ray tracers yet don't have this depth of field effect. But if you use a handheld camera, then somehow you have to model this effect as well, because this, this is how an image would be created on a film. So this is a nice chart made by photographers to see how exactly these F stops relate to aperture size, what are the typical settings and all of these interesting things and an actual example. So let's take a look. At the bottom right here you can see that the whole image is in focus. And as you adjust the F stop accordingly, you can see the top left. You can see here immediately that the background is heavily blurred. So this is a more pronounced depth of field effect. And it would be wonderful to have a ray tracer that can take this effect into account. And this is another maybe a bit more beautiful and a bit more visible example. So on the left side you can see a very pronounced depth of field effect. And on the right, everything close to everything is in focus. Yes. Do you also use the word bokeh for computer graphics? Yes, yes. And there is also a bunch of papers on how to simulate this effect. Some people even try to compute this in real time. So you have like a computer game, you would like to see this bouquet effect. How do you do this? And you have to take into consideration the depth. If you know what objects are where, exactly how far away, then you can do a bunch of tricks to get something like that in approximation in real time. And if you do this, something that I'm going to show you in a second, and you will have the very same effect in your ray tracer. So on the left, completely all in focus image, on the right, you can see again the depth of field effect, especially in the background. The further away you go, the more you see. So how do we do this? Very simple, let's skip the text and I just put this here because people who read this at home would know about this. So most of what we do is we shoot a ray through the midpoint of the pixel in our ray tracer. And this is going to touch this focal point and then hit an object. Well, what we could do is that we would also take samples from nearby, so not only this pixel, and not only the midpoint, but from nearby, and shoot all of these rays through the same focal point and compute the very same samples. But these samples will be nearby. What we do with these samples is we average them. And this is what is going to give you this depth of field effect. So this is already some kind of integration. This means that if you run a ray tracer, you're going to get a completely converged image without any noise, without any problems. That image you can consider dumb, but this will not be so with global illumination. This is a speciality of ray tracers. But if you have such an effect, then you may have to wait until more and more of these samples are computed and the more smooth image you will get. But we will talk about this effect extensively. It's going to be very important. And just an important question. What kind of material model can this be? Obviously this is some quick, perhaps OpenGL preview, but it's very apparent what I see. What kind of shading is this? Is it specular? No, these are definitely not mirrors. Okay, what else? Lambert? Yes, exactly. So this is Lambertian model. And you can also see this effect, that it goes completely black in these grazing gambles.










