 Okay, let's quickly study how to compute surface normals because we are going to need that. If you remember the diagrams, we always have the surface normal for the diffuse specular and the ambient shading. And just a quick remark, in the previous lecture we have talked about diffuse and specular shading and also ambient, but these are perhaps the most important ones for the simplified VRDS VRDS roles. And you can see them everywhere. So when you are in public transport, you can think about what object could be what is the case. Some objects are like a mixture of these VRDS roles. It is possible that I have a diffuse object with a glossy or specular coating on top of it. And you can move your head around like I told you before and see how the look of the object changes. So a lot of beauty to marvel at. And you will be able to also understand that, for instance, if you watch someone performing stand-up comedy, there are usually a lot of guys saying humorous things, and they almost always wear makeup. And the makeup artist tells them that yes, you need to wear makeup. And the artist says that you don't want to wear makeup. And they say, well, I don't care, you have to. Because otherwise you are sparkly. And this means that they start swearing. And if they start swearing, the skin is going to get a bit oily. And then it is specular. It's more specular. So it means that if I turn my head around, it will look a bit different. So that's going to be specular highlights. And if you use makeup, then this specular highlights disappear. And the whole face is going to be almost perfectly diffused. Therefore, it doesn't distract your audience. So light transport is everywhere. So if you ever wear makeup, then think about this. It's specular and diffused in the reflections. Okay. But I digress. So surface normals, I have an inquisite equation f of x, y equals zero. I would like to know the normals of this surface. How to construct a normal? Well, the normal is given by the gradient of the function. And just a quick just a quick reminder, the gradient of the function is a 3D function of x, y, z. And the gradient on every coordinate gives you the derivative of the function with respect to a given coordinate. Let's see an example. Imagine an elliptic parallel. You don't have to imagine that this is going to be an image. So this is x squared over a squared and so on. I'm not going to read formulae. And this is how it looks like. And if I would like to put together something like this, then I have to know that a and b are the curvatures of this thing in different dimensions. And therefore, these values are scalar values. Well, let's compute the surface normal of this elliptic parallel. But this would include differentiating the whole equation for the first coordinate with respect to x. So let's differentiate this with respect to x. Well, x squared is going to be 2x and x squared is going to remain there because it's a scalar multiplier. Why does it depend on x? It doesn't depend on x, therefore it falls off. z, it doesn't depend on x. Therefore, the first coordinate will be 2x over a squared. What about the second term? The second term is the function differentiated with respect to y. Okay, does x depend on y? No, this term is going to be 0. What about this? y squared is going to be 2y over b squared. z doesn't depend on y. Therefore, this is going to be the second term. What about the third term? A differentiated function with respect to z. z doesn't depend on x. Someone let me know. I mean, correct. It doesn't depend on it. Does he depend on y? It doesn't. Well, what's going to be the derivative of this expression? It's going to be minus a bit louder. Minus 1. It's going to be minus 1. Okay, let's see. Okay, we got this. So we can construct the surface normal of an elliptic parabola. Excellent. So when we do this intersection routine in ray tracing, I have a ray and I would like to intersect this against every single object that is in the room. The question is, what is the first object that the ray hits? Which intersection am I interested in? So there may be many. So if I look somewhere, I may intersect many different objects, but if things are not as distant or things are not as parent, then I'm only going to see the first intersection. And that's it. And the first should be the closest. So this should be easy because we are using parametric equations. They depend on t and t is the distance. So basically what we get as an output, this is going to be a list of t values that I'm interested in. I'm intersecting these objects. A list of t is 2510 minus 2, things like that. What the question is, which one do I choose out of this list of t's? Someone help me out. Smallest positive t? The smallest positive t. Okay, so the negative ones are not interested in like I told you, no politics, politics free zone. And I'm going to be interested in the smallest positive t. This is a more or less true. Negative t's, we are not interested in. We have discussed this. And the question is, can we take t equals 0? And I'm not telling this because I would be an annoying mathematician. I'm only half mathematician and I'm among the kinder ones. Okay, so I'm not asking this because I would be an annoying mathematician. I'm asking this because this is going to happen if you write a ray tracer. So lots of people are, you know, something is not working and I have no idea what went wrong. It is possible that t equals 0 and we need to handle this case. So just a second. Raise your hand if you know what t equals 0 means in an intersection. Okay, excellent. I will ask someone who I don't ask me. So, give your mind. Okay, have I asked you before? Yeah, just a minute ago. I will be out of order. Who did raise your hands? Okay, yeah, that's correct. My hands do not. Okay, so what's happening when t equals 0? I lose it's not worth the amount of camera. Sorry. We will shoot the ray from the original. Yes, exactly. So if we have some amount of bounces, if I get t equals 0, this means that I am exactly on the surface of the object that I am bouncing off of. So if I intersect against the sphere and I bounce the ray back the next, after the next intersection routine, I am almost guaranteed to see machine precision matter. But, mathematically, I am guaranteed to see t equals 0 because it's self intersection. The ray comes to this direction bounces back from the table, but it is on the top of the table. There is going to be like a trivial intersection, which is from the starting point of the ray. So we are not interested in this. So we are going to take as a conclusion the smallest non-negative and non-zero t. So in cold, we usually put there an epsilon like a very small number and we say that if it's the very least this number, then I will take the intersection because it's not self intersection anymore. Okay, after we adjusted this, a small beauty break. This is an image rendered with LuxRender, our glorious renderer. We are going to use this later during the course. And some more motivation. We'll be able to compute images like that. Isn't this beautiful? The previous image, the background was the renderer, so it's just a photo. That's cheating. That's cheating. Well, if you are in the mood to model, like an extremely high polycarbonate. Well, maybe it's from Ceger or more. Yeah, people do that too. But it gives you a really realistic lighting of the scene. You can use this thing in a later assignment to create beautiful images. By the way, there's a course gallery. Make sure to take a look because from previous years, people have created some amazing, amazing scenes. Raise your hand if you have seen this gallery. Okay, from the people who haven't seen, raise your hand if you're going to take a look at this after the course. Okay, excellent. I didn't see your hand. What's up? You have not looked, but you have to. Okay, because there's seriously some amazing things. I wouldn't say some people should have gone artists instead because this would say something about their knowledge. And it's not the case at all because these students are really smart guys, but they have some amazing artistic skills. And I'm sure that there are some artists inside some of you as well.