# TU Wien Rendering #9 - Hard and Soft Shadows

## Метаданные

- **Канал:** Two Minute Papers
- **YouTube:** https://www.youtube.com/watch?v=fcvhOC5Q1dI
- **Дата:** 30.03.2015
- **Длительность:** 16:30
- **Просмотры:** 8,589

## Описание

Ever wondered why shadows look like the way they do? Some are really hard shadow boundaries while others are smooth gradients. In this segment, we learn how to compute both by sending shadow rays towards light sources. This is a probabilistic technique, which is surprisingly equivalent to Monte Carlo integration, a powerful technique we will learn about later.

About the course:
This course aims to give an overview of basic and state-of-the-art methods of rendering. Offline methods such as ray and path tracing, photon mapping and many other algorithms are introduced and various refinement are explained. 

The basics of the involved physics, such as geometric optics, surface and media interaction with light and camera models are outlined. 

The apparatus of Monte Carlo methods is introduced which is heavily used in several algorithms and its refinement in the form of stratified sampling and the Metropolis-Hastings method is explained. 

At the end of the course students should be familiar with common techniques in rendering and find their way around the current state-of-the-art of the field. Furthermore the exercises should deepen the attendees' understanding of the basic principles of light transport and enable them to write a simple rendering program themselves.

These videos are the recordings of the lectures of 2015 at the Teschnische Universität Wien by Károly Zsolnai and Thomas Auzinger

Course website and slides → http://www.cg.tuwien.ac.at/courses/Rendering/
Subscribe → http://www.youtube.com/subscription_center?add_user=keeroyz
Web → https://cg.tuwien.ac.at/~zsolnai/
Twitter → https://twitter.com/karoly_zsolnai

## Содержание

### [0:00](https://www.youtube.com/watch?v=fcvhOC5Q1dI) <Untitled Chapter 1>

okay philosophical question what is the

### [0:03](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=3s) Definition of Shadows

definition of Shadows and we could run a long philosophical argument for now uh but let's conclude for now but only for now that Shadows are regions that are not visible from light sources and again if you're on public transport or if you're born on a lecture such as this one but hopefully not this one well you can take

### [0:27](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=27s) Shadow Regions

a look at the shadowed 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 with respect to the light source we have an umbra 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 where 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 shap 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 I'm interest in is it obstructed means that it hits something before it's blocked by something so the first question is a incredibly difficult question is this abstracted or not this first gr it's obstructed it is obstructed indeed okay what about this guy what do you think this is obstructed as well okay what about these guys I'm obstr these guys are good Okay cool so it is for now a very simple concept Shadows it means that I will 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 real life well in Real Life Point light sources don't exist because the point by mathematical definition is of measure zero it means that is infinitely small and something well we call it a light source so this is something that's infinitely small but it has a 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 uh 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 area 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 P which are partially shadowed regions so things are going to get much more interesting now I'm going to shoot two

### [3:36](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=216s) Shadow Rays

Shadow Rays from the surface towards different regions of the light source what about these guys what about the right Shadow Ray it's uded okay what about the left it's not uded okay excellent so this is this already doesn't seem why 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 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 penumbra and not just hard Shadows so if we only have the Umbra this is in the literature this is

### [4:30](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=270s) Hard Shadows

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 era 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 integrals over this for instance what we can do is we could shoot a lot of Shadow rays and try to approximate this area so the approximation is going to be the following I'm interested in the visible Shadow Rays the number of visible Shadow Rays over all the shadow Ray 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 uh out of 100 Shadow Rays does 100 hit the light source unobstructed definitely not what about 50 probably not okay well it's actually 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 hits it therefore this is what I'm going to multiply this intensity that I have computed with okay what about the next region this is a bit farther away out of 100 does 100 of them hit this region definitely not half of them what do you think half of them definitely okay cool and if we go even more uh out of the Umbra 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 which are definitely obstructed but it's not too much so let's say that 95 % of this Shadow is 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 uh what we have done here is actually Monte

### [7:13](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=433s) Monte Carlo Integration

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 mus clips of Lady Gaga and the others uh 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 top list it's one of the most effective techniques to evaluate integrals 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

### [7:55](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=475s) Bonus Question

such an image be physically correct well obviously it's a drawing so it's not correct but there is something that's unbelievably so incorrect that it would need some attention who can tell me yes that is true but unfortunately this is a mind reading exercise so you would have to figure out what I have thought no no I'm just kidding that's absolutely true P yes please tell me well um as far as I know physics the light should bend a little bit inwards from the black object but that's apparently not the we are very far away from thatal uh correctness but you are absolutely true so if I say in terms of Shadows wait I would have said say something about the shadows in the air shadows in the where well the Shadows between the object and the ground like yes okay what's up with this ARA wouldn't be shadowed hm that area wouldn't technically be shadowed itself which arrow the area this one or no no the air part between the object and the at this no okay then I don't understand any of the dark area between the surface of the object there's empty space which is 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 Umbra 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 Umbra it may be that yes I cannot construct any kind of Ray that HS the light source and as I move outwards it will continuously increase this probability there's not going to be a jump that you see this abrupt color 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

### [10:47](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=647s) Point Light Source

source excellent why there no this because I don't see the GL I see hard sh excellent so this should be a point like source and well technically you could say that if you have a smaller area light source but only one Shadow Rays so you don't do this integration just on one you can have something similar to this but uh generally these are Point light sources what about these guys the left one is point the right one the left one seems to be a point Life Source the right one I can see this beautiful continuous change and this is definitely a p but if I take a look at this region below this object then I can also see some kind of pbra 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 pbra but other places I see it and here on the right it has a really pronounced effect so this is definitely an AAL 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 SRA and umra is something but this is anything but perfectly black because boun always some reflection so you never have perfect yes that's true so there is an effect that we are going to talk about next lecture and it is called indirect

### [12:31](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=751s) Indirect Illumination

illumination and this basically means that in the r tracing program we are only accounting for the direct effect of a 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 pen region and then it goes towards my eye and therefore some of the energy is going to be picked up so the effect of this white wall is going to make these black or uh 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

### [13:20](https://www.youtube.com/watch?v=fcvhOC5Q1dI&t=800s) Direct Illumination

have is direct illumination and this is where the mm term comes into place what we have been talking about this mm term is just basically Bally adding something to this intensity that I have why because this warms up the image a bit 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 add this fixed gray number to it and therefore it would be a bit more gray so this is a hacky 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 lost energy in a ray Tracer yes I have a question uh for the um um monteo technique casting the shadow Rays how we how do we determine where at the surface of the light where we shooting the points because there's a surface how do we depict some random points on the surface these are the difficult details of R tracing pro programs there are techniques that help you to pick a uniformly uh 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 because what if a light source has nonuniform radiation so some light sources are really intense in One Direction but not in others how do I account for that and there's even optimization techniques for that and a short Beauty break well we like CLX render a lot and but it's seems that apparently some nerds are leing 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 in 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 oh

---
*Источник: https://ekstraktznaniy.ru/video/15003*