 Okay, philosophical question. What is the definition of shadows? And because run along with those people already went for now. But let's compute for now, only for now, that shadows are regions that are not visible from light sources. And again, if you're a public transport or if you're a board, a lecture, such as this one, but hopefully not this one. Well, you can take a look at the shadow of regions and you will immediately recognize that these are the regions that are somehow occluded with respect to the light source. Let's take a look at an example. This small red dot on the top, this is a light source. This is a point light source. And this black thing is a sphere. And behind that, what would respect to the light source, we have an umbrella. This is a completely shadowed region. This is the name of the completely shadowed region. And if we are going to shade these points in the ray tracer and if I want shadows, then I need to compute whether this ray, whether I am shading the point, is obstructed or occluded from the light source or not. Now, this is very simple to do. So imagine that I would like to shade this point below on the plane. And what I would do is I would send a ray that I call a shadow ray towards the light source. And what I'm interested in is, is it obstructed means that it hits something before it's blocked by something. So the first question is, is an incredibly difficult question. Is this obstructed or not? It is very straight. It is obstructed. What about this guy? What do you think? This is obstructed. What about these guys? These guys are good. Okay. Cool. Now, it is for now, very simple concept shadows. It means that I also have a visibility signal that I multiply the intensity with. And this is binary. Obviously, the ray either hits an object or it doesn't. That's it. So very simple. This intensity, that is not radiance, but this is the hack that we use in ray tracing. This is the simpler version of things still. I'm going to set to zero. Whatever shading I have at that point, I don't care. It is in shadows. It's going to be completely black. So this is the simpler version. What about wind life? Well, in wind life, point light sources don't exist because the point by mathematical definition is of measure zero. It means that it's infinite is small. And something that is infinite is small. Well, we called it a light source. So this is something that's infinite is small. But it has given amount of energy. Well, if you ask Stephen Hawking, he would say that this is a definition of a black hole. So we would have a black hole. And if this would happen, we would have much bigger problems than computing shadow rays. So that's definitely out of our interest at the moment. So we have an error light source and we still have the umbra because none of the rays make it to the light source. But we have a different region that we call a number which are partially shadowed regions. So things are going to get much more interesting. Now I'm going to shoot two shadow rays from the surface towards different regions of the land source. What about these guys? What about the right shadow ray? It's okay. What about the left? It's not okay. Excellent. So this is already doesn't seem binary anymore. And this visibility signal is going to be continuous. So there may be points which are visible from some part of the light source. But not visible from another part of the light source. And therefore we have some kind of partial occlusion. And the question is how do we compute this? How can we write a program that can give me a beautiful anumbra and not just hard shadows. So if we only have the umbra, this is in the literature. This is called hard shadows and penumbra is soft shadows. We're going to see examples of that in a second. So very simple. Let's try to approximate the area of the light source that is visible from that point over the whole area of the light source. Let's see an example of that. But first I'm interested in how to approximate this because I'm talking about areas. And this sounds like some kind of integration problem. And for now we are not going to evaluate intervals over this. For instance, what we can do is we could shoot a large shadow rays and try to approximate this area. So the approximation is going to be the following. I'm interested in the physical shadow rays, the number of visible shadow rays over all the shadow rays that I have computed. Well, example, how is this region going to look like? Well, I'm going to shoot 100 shadow rays from these small black dots. And I'm interested in how many of them is going to make it to the light source. What do you think? Well, out of 100 shadow rays, does 100 hinter light source? I'm not sure. Definitely not. Well, about 50? Probably not. Well, it's quite reasonably dark there. So let's say that three of them is the light source. It's very simple approximation. I shoot 100 shadow rays, three of them. Therefore, this is what I'm going to multiply this intensity that I have computed with. OK, what about the next region? This is a bit far from away. Out of 100, does 100 of them hit this region? Definitely not. How for them? What do you think? How for them definitely? OK, cool. And if we go even more out of the umbrella, then I have this white dot. And I'm interested in how many of these could hit the light source? Well, I think that there can be there are regions where which are definitely obstructed. But it's not much. So let's say that 95% of these shadow rays hit the light source. So I can already compute in a way soft shadows, not only shadows, but now soft shadows. You're going to see examples of that. And what we have done here is actually Monte Carlo integration. And you're going to hear a lot about Monte Carlo integration. It's in every list. I don't know. Some teenage people look up the top 10 billboard list of the best music clips of Lady Gaga and the others. What I do myself, I confess, I look up the top 10 mathematical techniques nowadays. And I tell you that Monte Carlo integration is always on the billboard's top list. It's one of the most effective techniques to evaluate intervals. And we're going to study them extensively. And it's going to make your life infinitely simple. Now, a quick bonus question is can such an image be physically correct, but obviously it's a drawing. So it's not correct. But there is something that unbelievably so incorrect that it would it would need some attention. Who can tell me that? Yes. That is true. But unfortunately, this is a mind reading exercise. So you have to figure out what I have taught. And just that's absolutely true. Yes, please tell me. Well, as far as I know physics, the line should bend a little bit inwards from the black object. But that's apparently not the. We are very far away from that. But you're absolutely true. So if I say in terms of shadows, wait. I would have said something about the shadows in the air. Shadows in the where? Well, the shadows between the object and the ground. Yes. Okay. What's what's up with the area wouldn't be shadow? The area wouldn't technically be shadow itself. Which arrow? The area. The area. This one or? No, no, no. The the airport between the object and the. At this. No. I don't understand any of this. The area between the surface of the object. There is empty space. Yeah. Which is. Yeah. What about if I ask about this transition from here to the outside? So if you imagine these dots that we have, if I would put it in the umbrella, and I would slowly move out of there, would I experience such a jump that I see here? Okay. Why not? Because if I start from the umbrella, it may be that yes, I cannot construct any kind of rain that is the light source. And as I move outwards, it will continuously increase this probability. There is not going to be a jump that you see this abrupt corner change. It is going to be a perfectly smooth gradient or almost perfectly smooth gradient, depending on many other physical properties. But this is more or less what I would see. And there's going to be an example of that in a second. So this is what I have said for those who are reading this at home. And the question is very simple question. What kind of light source do we have on this image? It's a point light source. Excellent. Why? Because I don't see the moon, I see much of it. Excellent. So this should be a point light source. And what technically you could say that if you have a smaller area light source, but only one shadow rays, so you won't do this integration, just for one shadow, you can have something similar for this. But generally these are point light sources. What about these guys? The left one is point, the left one seems to be a point light source. The right one, I can see this beautiful continuous change. And this is definitely a point light. But if I take a look at this region below this object, then I can also see some kind of point light. So it might be that this is a small on the left. It's a small area light source that is close to the object perhaps. And this is why I don't see the moon. But other places I see it. And here on the right it has a really pronounced effect. So this is definitely an area light source. Well, the next question is that in physical reality, we usually don't see perfectly black shadows. So if I take a look around in this room, I see shadows, I see there, a region that is lit, and then some kind of rock and the moon, rock is something, but this is anything about perfectly black. Because of the balance of the whole area, some reflections, so you never have perfect on the moon. Yes, that's true. So there is an effect that we are going to talk about next lecture. And it is called indirect illumination. And this basically means that in the ray tracing program, we are only accounting for the direct effect of an light source. But in physical reality, it is possible that the light comes in through this window, hits the wall first, this white wall, and then hits the ground in this color region, and then it goes towards the light. And therefore, some of the energy is going to be picked up, so the effect of this white wall is going to make this black or dark shadows lighter. And this we cannot compute yet. This is multiple diffuse bounces after each other. We cannot take this into account. We would need to solve the full rendering equation for this. So what we have is direct illumination. And this is where the ambient term comes into place. What we have been talking about, this ambient term is just basically adding something to this intensity that I have. Why? Because this works up the image of it. So I would have perfectly black shadows. And for instance, for this classroom, I would have an ambient intensity that is a color that is grayish. And therefore, these regions would not be perfectly black, but I would have this sixth grade number to it. And therefore, it would be a bit more gray. So this is a really crude approximation of indirect illumination. But it more or less works. At least it is an accepted way to cheat back this last energy in a ray tracer. Yes. I have a question for the Monte Carlo technique, so I will cast it there, shadow rays. How we how do we determine where at the surface of the light, where we are shooting the points, because there's a surface how do we pick some random points on the surface? These are difficult details of ray tracing programs. There are techniques that help you to pick a uniformly chosen random direction on a sphere, for instance, that I would shoot or uniform directions or points. So I choose a random point on the sphere, and I'm going to connect this to that other point. And so perfectly uniformly chosen random points. This I need to generate on the surface of the light source. And this I would need to sample. And there's also optimizations for that. What if a light source has a non uniform radiation. So some light sources are really intense in one direction, but not in others. How do I account for that? And there is even optimization techniques for that. And the short beauty break. Well, we like clocks render a lot. And but it seems that apparently some nerds are leaving their dreams in our program and creating people like that. There is lots of programs that help you achieving these realistic things. And later on, we will talk a bit about how skin realistic skin can be achieved, such as the one that you can see here. Because skin is not a surface. Skin is a volume. So not everyone knows. But some amount of the light is penetrating the surface of the skin. And it goes beneath the skin. It gets scattered and absorbed maybe even a thousand times there. And it may come out somewhere else from your skin. And this is why the older computer games, this is why humans look really fake and plastic because they don't account for this effect. And the newest computer games can compute this or something like this in real time. And this is what makes them so beautiful.