Ray Tracing Essentials Part 6: The Rendering Equation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi my name's Eric Ainsworth invidia and this talk is about the rendering equation I like to start with a quote from Roman pain the muse is not an artistic mystery but a mathematical equation and this is really good for the rendering equation the rendering equation it's not a rendering equation it's the rendering equation it really sums up how light gets to the eye and I can already see your eyes drooping in fact because you've just seen an equation put on a slide and oh my gosh what are we doing this is if you're gonna have one equation in your life make it this one if you're into computer graphics it has a few terms in it it all looks a bit like much but we'll break it down in this lesson and you'll find it's really worthwhile it gives you this tool where you can think about how light works what effects you want to do what effects you want to leave behind so to start with there's a bunch of inputs for the rendering equation which is there's a point X which is some point in the scene and that's the point let's say that you're looking at and there's an outgoing direction which is this Omega hat that W looking thing Omega hat out o sub o and that's an outgoing direction so it's basically a direction say towards the eye there's also an incoming direction which if you look at the far right of the equation you see an Omega hat eye and that's just some light is coming in from some other direction there's this surface normal if you have a flat surface say the floor the normal is the direction pointing straight up for example and then finally there's this s squared term which means it's all incoming directions so we're gonna be evaluating this piece on the right for all incoming directions light is coming in from a bunch of different directions how do they affect what we finally see from our eye the terms in this equation the first two are really easy the outgoing light on the far left that's basically saying given a point in giving an outgoing Direction what light do I see in other words I'm looking in a direction at some point well what light is coming from that point to start with there's the emitted light which is a function that looks just about the same it basically says given a point in giving an outgoing Direction what light is coming from that point so if you have a light source a lot of light is coming out from there and that just shines right to your eye and if everything in the world was a light source then we'd be done we wouldn't have to think about any of the equation to the right where the right equation comes in it has an incoming light a material and this Lambert geometric term so the incoming light is basically saying okay given a point and given some direction what do I see in that direction what light is coming from that direction the material equation is just simply a function that says okay given an incoming in an outgoing direction what light goes in the outgoing direction so in other words like a mirror for example will be very reflective in one direction so the incoming and the outgoing directions are closely related but other surfaces many different incoming directions will give a different term different amount of light bouncing off the surface and then finally there's this Lambert term which is this incoming direction times the normal and that's a geometric term and I'll show what that means what happens with the Lambert cosine law it's an old idea and it's just simply something that's kind of intuitively true that if a lights directly overhead it's going to have the most effect on a surface but as you tilt the light the effect of that light is going to be less and less as it gets to the horizon so on the far right of this you can see how the light kind of spreads out as we get to this shallower angle and that's all that term is and this is just another visualization of that term where it's showing how it decreases over angle so what pure path tracing does is it basically says all I'm going to do is I'm going to sum up the light in all directions and that's what's going to go towards the eye so in path tracing what we do is we kind of shoot array and then we shoot another ray off that surface in some other direction so with path tracing what we did is shoot a ray from the eye and hits this box and then from there it's scatters outraised in various directions so each path is a different direction one may go up and hit the sky another one may go and hit the ground and that bounces somewhere else and so on and so forth and we add up all the contributions of those paths to get the color at the EEI the trick with this is that we don't really know in a given direction what the light is sometimes we do if we look directly at the Sun well we know what that is but often we it's something else and so the rendering equation is actually a recursive equation it's one where it says well what's the incoming light direction and intensity rather from a direction well we don't know so what we have to do is use the rendering equation again on the place that we just hit so if I hit the box and then I hit the cylinder we'd apply the rendering equation at the cylinder and so on and so forth until we finally get an answer the trick with that is that if you did a pure path trace it's a very slow process to converge if you don't have a big light source like so if you didn't have for example the sky so that you know when array hits the sky you're done you could be in trouble like if you just have a small light source in the scene pure path tracing says well I'm gonna bounce my Ray's around until I hit a light and that's a problem because if the light small that could be a very very long number of bounces there's things what we do about this one is called importance sampling and it basically says there's got to be good directions for me to go shoot my Ray's in let's see what they are one approach with important sampling is to just look at the effect of the material so we take that Lambert term and we take the material function where it has an incoming and an outgoing direction which if you want to impress people at cocktail parties is the bi-directional scattering distribution function the BS DF and all that is is a fancy way of saying well when light comes in from this direction what effect does it have on the material for example if the materials black well there's not going to be any outgoing light but in general there's some outgoing term that will respond to different directions with a mirror for example it's clear that the outgoing direction is going to basically be a reflection direction from the incoming direction and that's the only direction that really matters to us so if we're path tracing and we hit a perfect mirror we can just always shoot our ray out in that direction and feel good about life because we know that light from different directions so it's not going to really matter too much for a glassy surface where it's got like a sheen then you might shoot out a burst of Ray's and so for each path you might choose a different ray and decide to go one way or the other and so on and that adding up all those paths should give you a pretty good result finally you have something like a diffuse or a matte surface like unglazed pottery or cement or things like that where light can be coming in from all different directions and contribute to the outgoing direction and there are you doing more of like a Lambert's law kind of a distribution you're going in all different directions however you want again that can be expensive so there's yet another way that we go to try to reduce the load it's called multiple importance sampling and here we say well okay we will vary by the material but we also want to vary using the light direction so if we know that there's an important light source in the room or if there know that there's the sun's out there or something like that we'll also add that in as an important place to shoot rays basically so instead of just shooting them kind of randomly we'll say oh I also shoot some rays towards that light because I know that light's gonna be a really important direct lighting effect but it's also worthwhile to shoot these other rays because we want to catch some of the indirect lighting so in a mirror reflection or a glassy or diffuse it's all sort of the same idea we're gonna try to shoot a bunch at the light and we might weight them by how much they'll matter that the diffuse when it's going to matter perhaps more the reflection one perhaps less because we really mostly care about what's in the reflection direction so I will not go through this image but it's really worth looking at this image of multiple important sampling it's from a classic paper 1995 and you can try to think this one through consider this year quiz is shininess is varying at the top there are a bunch of light sources and the radius of those light sources is increasing in each one of the three figures and in one we're just sampling the light source and another we're sampling this brdf which is the bi-directional reflectance distribution function and that's like the scattering function but it's meant for surfaces and it's where things that are opaque not like glass and then you have this M is multiple important sampling where you're doing both and you can see that both is better basically and this is a good one to try to think through why do some of these images look fuzzy if once you understand that then you've got a level of enlightenment on the rendering equation so as an example of path tracing Nvidia picked up some open source code from some researchers who were looking at quick to an old game but they decided well now that we have ray tracing acceleration let's do a path trace version of it like really crank up the good lighting and materials and so on and it makes a dramatic difference you know it's the same assets but just improving the lighting alone can really make the game shine and now you've got the rendering equation under your belt it's really honestly a wonderful tool for thinking about lighting and how it percolates through a scene and what you care about for further resources see the website and I also want to mention that there's this book called ray tracing gems that's downloadable for free [Music]
Info
Channel: NVIDIA Developer
Views: 26,904
Rating: undefined out of 5
Keywords:
Id: AODo_RjJoUA
Channel Id: undefined
Length: 9min 24sec (564 seconds)
Published: Wed Apr 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.