 Are you ready? Yeah, sure. Can we start? I guess. Well, thanks for showing up. Actually a lot more people and I expect it. My name is Frederik Steinmetz. That was pretty... That keeps changing. Okay, I'll try to talk directly into it. Okay, my name is Frederik Steinmetz. I work with Gottfried for BlendeDeplom.com and this talk is called Cycles Light and Magic and the only reason why I call it magic is that in real life, of course, you can't distinguish... Well, light is light. You can't distinguish between a camera or a shadow ray and all the other rays. In photography, you just look through a camera and you take a picture. In cycles, it's different and that's what I meant by magic. What you do is every time a ray gets cast into the scene, it is a type and every time it interacts with the surface, it actually changes its type and you can see the camera ray is actually ray number zero. The ray does not get cast from the light source as it is in real life. It gets cast from the camera and thereby you can distinguish between different rays originating from the camera. The first ray is always a camera ray until it bounces. It hits an object over here. This is supposed to be a glass object and that means at this point it has a chance to become a transmission ray, which means it goes into the glass sphere or it gets reflected directly which means it goes away from the glass sphere. In this case, it will become a glossy ray which you can see on this side that would be a glossy ray in the glass sphere. It becomes a transmission ray and after it hits the ground which is supposed to be diffuse it becomes a diffuse ray and so on and it disregards what it was before so it is always only one type except for the reflection ray which would be any bounds of a diffuse or reflective surface. Any ray that is not a transmission ray is actually a reflection ray as well. If you look at the outputs of this node you can see the is in front of all of these and that means it is either true or false. There is no half glossy ray which means this returns either 1 or 0 depending on the type of ray depending what surface the ray touched last. Then we have three more options that don't have an is in front of them which means that they can use other than 1 or 0. The ray length is whenever a ray passes a transparent surface or a reflective surface including glass its length will be measured from the point when it touched the object. That would be for example here the length after hitting this point, the length of the transmission ray that would be the ray length. So these are either 1 or 0 and this one is a distance so it's measuring a distance it can have decimals whereas the ray depth and the transparent depth they can only be integers meaning whole numbers. That is every time a ray bounces and that includes the transmission rays also considered a bounce so every time a ray bounces this number gets increased and the transparent shaders and cycles are not physically correct so they are their own type of shader and that's why they are captured with the transparent depth as opposed to the ray depth. There's a slight distinguishing between the two. Okay and I'm going to show you a couple of examples that I've prepared and we're going to kind of ignore these because well the time is pretty limited and I'm going to focus on the camera ray, shadow ray, diffuse ray, glossy ray and the transparent depth and the camera ray I've already said that it's before any bounce as soon as the ray touches the surface it is not a camera ray anymore a shadow ray is a special sort of ray it's kind of part of the magic because it's really hard to grasp what it is I think but we have I think a good explanation for the next slide and of course if a ray bounces off a diffuse surface it becomes a diffuse ray and the same thing with the glossy surface and I've already mentioned every time a ray passes a transparent surface it gets counted and this gets raised one. Okay one last look at these at one of the images this is actually from the cycles encyclopedia that me and my colleague wrote and there's a lot more explanation also of course on the topics I skipped today those here and you can see after the transmission the ray bounces here and it bounces off the diffuse and if we have only three bounces max you can you can tell cycles how many bounces it can handle maximum you'll see that the ray bounces last and it's terminated so it never reached a light source so if we wouldn't have the shadow rays this area behind the sphere would be dark of course there is a chance that one of these rays bounces towards the light source but it's very minute so chances are that this entire area would be very dark unless we make cycles creates a shadow ray each bounce so every time a ray bounces a shadow ray will be created and it searches for a light source you can select if it's supposed to search for all light source or if it just takes a random one meaning this for example this bounce it gets illuminated by the shadow ray as well as any other ray that hits the light source anyways so this is kind of a method that I think all path traces use might be some exceptions that I don't know about but most path traces do that and every time they bounce they search for a light source in order to illuminate the pixel more than an actual regular bounce would so let's head over into blender and let me show you a few examples what I have here is two cubes and they're both emitting light actually if I click on it you can see it's in emission material and the right one has in emission material as well but I can now connect the strength of the emission for example to the camera ray that means it's still shadeless it's got exactly what color we specify here it doesn't take into account any of the geometry but basically only show the outline and also as opposed to this light source it will not illuminate anything else but only emitting for the camera therefore it will also not accept shadows or receive shadows I should say this is a different example these are two spheres and right now they don't really differ in their settings they both have a strength of 0.2 I just used the multiply node to show the similarities but you can see here is multiplying the transparent depth by 0.2 and it's plugged into the strength so right now there is no transparent depth so this is 0 times any number is still 0 of course and then this node is calculated with a strength of 0 and that's why this one is actually shown black and I've prepared something here you can see this is a transparent shader and also just to prove that this is magic there's nothing in my sleeves and you can see if I drag this across you won't see the plane it won't get rendered because it's 100% transparent but it will illuminate this sphere or I should rather say it will increase the strength of the sphere because right now we're getting one transmission one ray going through the transparent surface and therefore we get the same strength as here because right now it's 1 times 0.2 which is the same as the 1 times 0.2 and what is even more exciting at least I think so if I duplicate this you can see now I have two of the transparent planes and that means I get twice the lightness so as opposed to these not a wrong one as opposed to these either or this one actually counts the other one had a camera ray which means it's only for the camera it's 1 for the rest it's 0 so it didn't emit light in this case it counts how often the light is emitted and I can do this as often as I want increasing the strength of this sphere each time I each time I create a new transparent surface before in front of it and I have prepared a little addition to that material if I now connect this you can see the part of the sphere that gets hit by three bounces by three transparent transmission rays it gets green because from the count that the transparent depth gives me I subtract 2 if this is smaller than 0 it will also return 0 I can hit the clamp but it also does that automatically because if you use a factor you can't get below 0 and you can't get above 1 that's just the nature of the factor so it automatically clamps the values between 0 and 1 so if I were to duplicate this again I would use green surface and because now this is 4 subtract 2 which is still 2 which is greater than 1 and means it gets the lower material all the way ok so that would be the transparent depth and another example is architectural glass you have if something happened if I use a glass shader on this directly I get first of all I get a strange behavior in the shadow because I would expect that the diffuse material from the frame here would cast a different type of shadow than the glass does and this would actually be true if I increase the samples and I have to enable refractive caustics but disable that the shadow will be treated the same way as a diffuse surface would be and also if I turn on refractive caustics I get a lot of noise right now this is just a plane so the noise is at a minimum but it will also count for all the other objects in your scene so being able to avoid refractive caustics greatly increases the time decreases the time in which your rendering will clear up so it will decrease a lot of noise so it's actually preferable not to use the caustics I'm going to turn them off now for the demonstration and I'm going to have a look at what happens if I you can see I'm bypassing this this is normal glass right now what I like to do for natural glass it doesn't need all the capabilities it doesn't need to cast these refractive caustics can you actually see that in the preview if I turn them on no in theory you can see that over here this caustics the light that hits the bottle it doesn't get reflected all the way some of it passes through some of it gets I don't know the English word shaded I guess to form these brighter areas and these brighter areas are very noisy until you have a high number of samples cycles isn't that suited to actually cope with them so if you can avoid them do it and what I'm just simply going to do is I'm going to mix the glass shader with a transparent shader and I say the shadow ray is the factor the shadow ray in this case is any ray that would be blocked and so that one let's get back to this one more time the shadow ray here gets blocked so a shadow ray would actually be what happens after you pass the surface so in this case you can see now the shadow is nice and it's differing from the frame because the shadow rays hit a completely transparent material which means it gets they get invisible and you can even change the colors of the shadow by using this method because the shadow gets created by the transparent material because the is shadow ray is the factor to mix the two so this is a nice additional effect that you can use using this method I'm going to leave this at blue now and let's have a look at another difference you can see this is glass material everything except the shadow is a glass material which means you get the reflection of the cone behind the glass and you get the reflection of the cone in front of the glass and they sort of mix and this is realistic if you look at a window from a different ankle you can see this is actually happening but let's say you don't want that let's say you don't want the cone behind the glass to be reflected from the backside because I can easily imagine a situation or a scenario where that would be the case we can exchange the glass shader by a glossy shader glossy shader would now reflect only the cone but we can see through the glass anymore the shadow ray still can so the shadow is still the same because the mix factor didn't change but the glass is no longer transparent we can see through it and a glass shader is actually a reflection shader mixed with a refraction shader by a Fresnel value to explain Fresnel that would take quite a while so I'm just going to demonstrate it now I'm going to use a converter math shader and I'm going to add the Fresnel to the shadow ray and use this as a factor now we can see through the glass if we exchange those two you can I should have prepared this better I think the Fresnel value is too great ok it worked in the test I'm going to I'm going to fix this and you can download the blend file right it should be add I'll fix this and you can no refraction just out there still blue ok sorry about that I'll fix that and you can it's the normals ok flip the normals now it works ok let's not get too crazy with this because I have a few more examples and also I think I'm running out of time this is the wrong layer here we have a new example because there is a huge difference between using the light path node and emitting object or using the light path node on normal object the architectural glass was already an example where I didn't use an emitting object and here I have another one what I have is Suzanne in a normal scene but I have a magic looking glass which is actually able to use it as an x-ray glass to look inside of Suzanne if I do that you can see the inside of her head no surprise there isn't a brain but we got some gears from the it's an add-on in the trunk I just used that to produce some gears so let's have a look at that shader it's a bit more complicated because I need the backside to be blue so if I just mix that you can see through the entirety of Suzanne you can see the background through her but if I mix in the back facing with a regular diffuse shader and this is what the background becomes and you can see just in case I use a glass shader for the magnifying glass for the looking glass I mix the two for rendering speed I can either use transparent or I can use the glass and that is determined by the fact that I'm adding the transmission ray to the transparent depth and this is this is another thing I kind of forgot to mention if you have an either or you need and you want to influence two different rays you need to mix them with a logical or so if you mix them by if you use an or like I do here then it doesn't matter if it's a transmission ray or a transparent ray they do the same thing but sometimes I want an and meaning I only want something to react if it's a diffuse ray and a reflection ray or something like that or and a transmission ray that would make more sense so a logical or is actually an ad which sometimes confuses my students because ad is kind of and and ad is basically a very similar word but if you imagine adding one and one it would still be one clamping so one and one is one one and zero is one and zero and one is also one only zero and zero will return zero and if I multiply them only if both are one we get the result of one because one times zero or zero times one zero times zero is all zero so logical and would be ad the logical and would be multiply and the logical or would be ad and I guess that's it with my samples here we have one more it's a bit more simple so maybe I should have started with that instead of the Suzanne head what I do is I use the same color and I invert it for this diffuse material and I say as soon as you are reflecting in a mirror with a glossy ray then show the inverted color and as long as you are not reflecting meaning the camera ray diffuse ray all the other rays it will show this color so as soon as she gets seen in the mirror the color is inverted and with that I think I'm out of time and you go ahead and ask questions if you want to no questions? do I need to continue? I'm not sure well I'm done with my examples yes the light path note is very complex that's why I didn't go into detail about all the about all the options but there is a very complete source which explains it in detail in whole and it's called the cycles encyclopedia which is the book that we wrote, Gottfried and I and you can get it on our homepage I think when I was researching the cycle the light path note it took me quite a while to figure everything out there was a chunk here, a chunk there and it was really tedious to combine this all and we did tons of tests because we got surprised by this note quite a lot a lot of the times we were just why didn't that work as expected you saw with the architectural reflection glass that happened to us a lot and we put all that knowledge all the tests we put into the cycles encyclopedia that you can get either at blenderdiplom.com or in the blender eStore and I think there's I don't think there's a source that's as complete where you have all the details information in one place I don't think that exists have you ever done any yes on blenderdiplom.com there's a lot of video courses but so far there's none about the light path note if that's what you're asking it's only in the book, yes please I use it a lot actually for example I don't think I have a scene where I don't use it at all what you can do is if you have an HDR lighting and you want to boost the glossy part of it you can actually let's just do that but that would be again freehand it might not work for example if I have a value of one and I boost the diffuse well right now we only have diffuse so we won't see the difference you can for example add to the strength diffuse and that will every diffuse surface will be twice as bright now so if you know your reflections are too dark or you want overexposed reflections but not influence the diffuse you can just add glossy to your strength and it will all sorry glossy to your strength and it will only illuminate the glossy objects you can actually see that here the mirror is now the environment and I think you can see it best like that if I mute this I get only the diffuse and if I use this as a if I use a diffuse for example you can see the monkey gets brighter and the environment again monkey gets brighter, glass gets darker so you have very fine control over the different light sources and you can also boost refraction for example if you use a transmission ray you can increase the refraction caustics of objects of your scene because they tend to be a little dark so you can see them better yes, realistic caustics in cycles right now take a long time to clear up so I would wait for metropolis to be implemented but other than that if you want to use I would use mesh lights and if you don't want to use mesh lights you actually have to turn on multiple important sampling just in case you're wondering why your caustics don't show up if you're using spotlights or suns they need to have multiple important samples enabled what else that would be the specialty of the gentlemen to the right of you too over what you want to know the glass shader if you use a higher index of refraction the factor of the Fresnel gets boosted as well for example if I I only have a single colored background so probably not going to see that much um I use a glass shader and let me use a skylight as well so perspective view okay so if I boost the we have a list of of the IOR the index of refraction of different materials in the book as well if I increase the do we have the glass shader as an example on the homepage no the glass shader well let me just check it might still be um yes the comparison treat isn't that glass there we go internet well I think I might have them in the drop box as well that's just a note okay we have tons of examples like that where and let me see maybe it's done loading oh yeah we go soon as this image is loaded I can show you let me disconnect dropbox and loads faster okay here we go we have for every shader we have at least one sheet like this testing it out for some of the shaders that are more complex like the tune shader where it's not just the shader settings and the lighting we have for here you can see this would be the difference between backman and ggx and over here you have sharp and there you can see what happens if you increase the index of refraction you can see that the higher the index of refraction it's not only the stuff behind the object that gets more refracted but you can also see the Fresnel effect of the surface gets increased and in the end if we have an IOR of 3 it's basically a glossy material so for there should be some subtle difference but the highest index of refraction in nature should be diamond which has an IOR of about 2.2 so 3 is already beyond nature but that's funny in blender because a lot of the times they won't limit factors to realistic stuff because it works still with the mathematics behind cycles so you can just go nuts which sometimes produces very funny results what I would definitely recommend for that kind of test is these options as if you say it doesn't get shown in the glossy it will not get shown in the I think you're referring to a paper from Disney where they were using bump maps in the reflections whereas they were using real geometry in the objects so what I could do right now is I could duplicate this object then turn back on the glossy and disable the subsurf multi and I should also turn off camera so this way we have alright let's not use glass for that let's use diffuse because it's confusing diffuse diffuse and of course the other object should get diffuse as well now that why is that black why is that shown by camera oh yeah yeah let's just turn off everything okay there seems to be something alright I forgot we're looking for diffuse yes that would be the technique you would use the high poly object for the camera uncheck its glossy visibility and in the and in the reflections you would use a low poly object with a bump map to simulate the because I think actually the render times might get worse with the method you just described but I haven't tested that that's it okay then thanks for listening we'll see you in the next video we'll see you in the next video bye you