In a lot of my videos I say that software doesn't matter. It is you and the knowledge about the software that matters. Today we're going deep gentlemen. After this video you will understand how the magic behind your renders works. Fun! The more you know about these deep processes, the more control you have over everything, over the look of your 3D scene and more importantly over the time it takes to render your 3D scene. First, in my talk about render engines I briefly mentioned the light in photography and cinematography. Let's briefly get back to that topic. Photos and videos are a result of our camera recording light. Humans have an ultimate sensor called eyes. That's why the light is the most important aspect and it defines the look, the feel, the quality of your photos and videos. I have a big light source on my right. The rays this light emits are scattered across my room and reflected by other objects I have here. Each ray from this light source gets bounced billions of times before it gets to my camera sensor and gets recorded. You can imagine how many rays are there in this room right now bouncing trillions of times. This is why real life looks so good. Good models, textures, materials, eternal variety of elements and the enormous amount of light bounces captured by our eyes or camera. One of the most popular topics is the hardware we use in our work and it makes sense because opposed to real world computers have limits of what they can calculate. In real life, eyes are capturing an uncomfortable amount of data non-stop. Computers are far away from that kind of processing power and clever people came up with different rendering methods. There are several rendering methods. Restoration, ray casting, ray tracing and path tracing. There are also subgroups for these but we won't go that deep. Let's start with the restoration. This is what was possible in the beginning of computer era and it is what all computer games are using till this day. This method doesn't use any rays. It simply helps to display geometry on your screen. Basically, restoration takes vector data and transforms it into pixels. It refers to both. Primitives like polygons and 3D models. To make it simpler, 3D models consist of polygons. Polygons are formed with points. Points are placed in space using different math. 3D scenes are using XYZ coordinates. Remember geometry in school? But your screen is flat to the XY plane. For example, here is our camera. Imagine that this is our screen with pixels in it. The rust riser takes the points from every polygon and calculates where to put them on screen. Then it's processing the space between the points and turns the shape into a group of pixels. After all polygons are processed, the computer is able to show you the 2D representation of your 3D object. Restarization is what our 3D softwares are using to display our scene in the viewport. And it's still the most popular way of producing 3D graphics in real time. It is extremely fast because it's simply a process of transforming our scene geometry into pixels. This doesn't really sound like actual rendering, does it? Indeed, looking at your scene in a viewport is also a rendering method. The second method back in a day is when computers just appeared was rendering using ray casting. I prepared a 3D scene that will help me to demonstrate everything. The rays are casted from the camera one through every pixel. When the objects in this scene are intersected by the ray, the computer records the closest point to the camera and its color value that can be determined from a texture. Let's say we want our image to be 1000 by 1000 pixels resolution. This means the computer have to cast 1 million rays. Each ray calculation is tense, if not hundreds of lines of code to process. I think you guessed how challenging it was back to 70s. A massive amount of calculations for the computers to do. This method also limits everything creatively, as it's only a texture that defines the color of geometry. As the rays going one direction only, it means no reflections or shadows possible. Does that remind you something? This flat looks started to change in 1980 when a man called Turner Whitted turned ray casting into something different, something revolutionary. Previously Whitted made researches for a nuclear power industry and he was studying the behavior of light photons in space. So this clever man knew exactly how light behaves in real life. Let's look at our sample 3D scene again. Whitted introduced what we know as ray bounces, the ray tracing method. With this method the computer is also sending a ray through every pixel, but when the ray hits an object instead of recording the data straight away, the computer sends more rays. One to each light source from this intersection to find out how these lights are affecting the color or brightness of this point. The point could now have shading and illumination data calculated. If that ray did meet another geometry on its weight light source, it means there is something blocking the light and our intersection point should be darker as it lights in the shadow. If the object was reflective, the computer sent a new ray forward at a certain angle to check if there is another object which should be reflected in our intersection point and so on until the ray meets a light source. This was revolutionary because artists could finally art direct the scene. They could dictate the behavior of the rays by setting up the materials. A material dictates how light should be reflected or maybe it's absorbed or maybe the light goes through the material. There are billions of these bounces drawing our scene appearance. Over the years this method got modified and improved, but still it wasn't a simulation of reality. These calculations simulated only a reflection, a reflection and hard shadows. Hard shadows because the light in this method is a point in space to which rays are traveling. To get soft shadows we have to cheat to get global illumination, we have to cheat and so on. It was a huge jump towards a photo realistic renders that we are familiar with nowadays though. Ray Tracing has been promised for years as a ultimate gaming experience, but even today's computers are too slow for this method to be calculated at 60 FPS. Technology is constantly evolving and what we see in real-time renders nowadays is truly impressive. Just this year we have seen the Star Wars real-time ray tracing demo released by Unreal Engine. It was powered by NVIDIA's RTX technology. Still required a computer which costs $50,000 to run at 24 frames per second, but that is a perfect example of how realistic real-time rendering can be. With good skills and time to spend on cheating, ray tracing is good for everything including now real-time engines. But what about let's say VFX where image has to be flawless in order to be believable? There is a purely offline rendering method that is not suitable for real-time engines just yet due to calculations needed and it's called path tracing. Once again, it sends rays through pixels, but when the ray hits an object instead of tracing new rays to the points of light sources, it keeps bouncing the same ray between scene objects as many times as necessary to get to light source. This allows to gather information about the objects that are close to each other, find out what color they are and if that color affects the previous object. In simple words, the rays are acting like light in a real world. This is why the path tracing engines care about size of the light, not only the position. Because every individual ray can hit a surface of their light. It is no longer restricted to a point. You will have your soft shadows calculated properly, color bleeding like let's say if a colored object is intensely lit. Costics like fancy light reflections through the bottle. Nowadays GPUs are getting more and more advanced powering path tracing engines and you can add many GPUs in one system more than processors. This means you can render realistic scenes in the matter of seconds. But everything always depends on a lot of factors. For instance, I'm waiting for Octane 4 to be ready for production use because they're introducing the noise system. Noise in path tracing render engines is one of the most painful topics and looks like Octane 4 eliminated that problem. But this is a topic for another video. How does it feel now when you know exactly what's going on behind your renders and how they are born? If you guys still have questions feel free to use comment section. Thumbs up if that lecture was interesting to you. Subscribe if CG and VFX is something you're into. Thanks for watching guys. See you soon. Peace!