 Welcome everybody, enjoy your meal and have a nice time and I hope that while eating you can listen to some stuff about glass that I prepared for you and the name of this lesson was originally everything you ever wanted to know about rendering glass not only with cycles but my wife saw the title of this lesson and she said oh what a megalomaniac and boring name you know it's like everybody names things like this and okay so I had to do this and so I didn't fit in turn and I just do few tricks that I learned and it's like there is quite a lot of tutorials about how to render glass and I simply try to cover topics that are not covered in these tutorials that are prominent on YouTube and this is like how to render water in a glass or some other tutorials that are covered and I try to find the topics that are not covered so these are just few small tricks and first thing I will write down like when you're rendering something that is translucent or his glass it's not only glass it's also water of course and other materials then is to know something about race about how they intersect which I will show you later because that helps you to set up things correctly then something up shaders that's the main topic of this lesson and avoiding some mistakes in modeling because some details on glass elements can screw up how things look and solving noise noise and fireflies I made this with a line because although that's what is covered quite well in other tutorials and rendering caustics I won't cover it by half that I don't know how to do it in cycles and that it's also covered in some tutorial by Gleb Alexandrov I think and in some shader that was presented yesterday in the talks in the five minute talks first thing is I made my job to check other artists work I see a lot of what other artists do and I realize there are some very common mistakes that artists do and one is color of the glass shader it's kind of fixed in 2.80 because if you add glass shader its color is set to 100% white but in 2.79 a lot of people were adding glass and the color was not white actually it was a bit gray and that's what you get in the principle shader so that's just the first very basic thing that if you make glass with principles shader remember to set it completely white it's I see this really often also some advanced artists do it just because they're not focused on it and here is a glass rendering that looks almost good but I think something strange with it and I see this also quite often and there's there's something problematic is in this render do you see what it is why well it's this area and it's black and if you would take a photo of such an area it this would not happen like it can happen if there are some black objects in the space that you are photographing that they somehow the blackness gets there but usually the case why this appears is the rate depth and it's interesting that this is the default settings in Blender the rate depth simply meant for those who don't know it's how many times a sample or array can go through some point where it either reflects or goes through the surface and it's interesting that the at the default of this black area in the glass are not you would guess glass is where the rays go through okay so I will increase the rays that should go through to get rid of this black area but in reality it's mostly the glossy samples I will show in a moment why and then there are some sometimes it's the transmission rays of course too but the glossy samples are more at fault because of internal reflections inside of glass and of course then there are total rays and here I will show why it's the glossy rays okay by the way this animation was rendered with a blender because I didn't find any other software that could simulate optical effects like this and this is some very regular shape and we can see that the what happens is not that complex mainly there is a ray coming through some part of the ray reflects some part reflects inside and back and goes outside but in total we could count one or two or three depth of the rays and here comes another shape and I changed it just a little I made just a little bump in this shape sorry what we see that already there are things happening that are much more complex than before in the simple shape and that's because if sometimes when late rays get inside shape like this they get trapped inside because internal reflection of glass is much more and strict than the external you can see that inside of this glass shape basically once the ray comes in it almost doesn't get out especially in the first shape and it's because the index of refraction inside of glass is the opposite as if the ray comes from outside so the light ray basically gets trapped so there are like for example for transmission depth in this example but regarding glossy it can be over 20 40 and so one way to fix this is this especially interior artist will say oh this is a great solution let's let's spend the rest of our life surrendering here I made the animation what happens and this is external lighting okay I made this easy for me what happens and how many rays do we need to to get to the point where the glass is really nice and shiny and it kind of keeps counting and here I increase both glossy and transmission rays but generally it can be improved mostly only with the glossy right settings okay and around 30 I can see that that's enough 30 in an open environment okay so yeah here is a little example you know from some job I did and here actually the reflections were much more because it's droplets and as I showed the irregular shape I was like really confused what is happening there was and I back then I didn't know how to solve it advice so I said just the reflections and reflection crazy high and now I have this simple solution to it and it's basically like checking the rate depth and after some rate depth telling the shader that the ray can get out but it's the rate up of I in my test around 10 is good because if you have more glass objects until some depth there are glasses behind each other the eye would recognize that basically this the next glass disappeared or but after several reflections you cannot see it because it's just too many objects behind other and you have to care so this is quite simple that after certain rate depth and I have here greater than you switch from glass to transparent shader and the ray gets out and it's happily shiny white or whatever and okay here's a detail for those who don't see it and this is another animation I did and this is basically rate depth with this shit and like when like the stop condition like which I said to 10 so I can see that when I came down to 0 to 5 where this ends it looks okay and the black areas and the whole glass piece is shiny so and that's it that's that's the main magic yes yes this is the way to kill the black spots and keep the whole glass shiny like it's it's I found it to be quite universal usable but this these are some common modeling mistakes on glass and it happened and again here the depth is set quite not that high but quite high already and you can see that the border of the glass looks a bit weird like some glasses are actually manufactured like this so it might be correct also but traditional glass makers make a little shape on the edge of the glass that that goes like this it's better on the lip when you drink from it but also it's I the reason is that the edge of the glass looks China somehow so the to the left there are three solutions that I sometimes see first one is like very badly applied subdivision surface modifier with no extra edges on added close to the border of the glass the second is basically making sharp edges using edge crease and the third solution is adding edges close to the top but not not making the bulge soon like you have the edge of the glass and you just add two loops below so that makes the subdivision surface modifier do a nice round shape but if you do the bulging it looks slightly better in my opinion here is the same render with more light rays and especially in the first case there is still something wrong like the others look kind of okay or better yeah this is the detail of it and here is the correct solution when there are actually more loops below the edge okay let's go further now I wanted to speak about sheet of glass and why if you have a sheet of glass is green from the side and it's such a big difference and if you look from front and from the side because at first sight it doesn't make much logic to me so but this animation shows quite clearly what is happening if you have a sheet of glass and you look from front yeah like before I said glass is actually I said in the beginning that the glass is white and it glass is actually mostly green but it can be also of course many different colors but the pure glass we are used to CS pure clear glass has some impurities and it's usually green from some metals or some stuff like this and it's only visible when the glass is really thick so if it's one meter thick or two meters thick then then it can be really green and what happens if you have this glass glass sheet and from the front okay I will come back a bit because this this animation also explains the fresnel effect but basically in the beginning there is the light ray that comes through mostly and it spends very small amount of time in the glass of course some is reflected and here you can see the reflection ray is much weaker than the ray that comes through and because of the index of reflection effect and how these things work like the more there is an angle the less of light comes through and the more is reflected okay there is also some dispersion here but you can ignore it I made it just to make it look more beautiful so here you can see quite clearly the fresnel effect and what happens but okay and this is what happens from the side if the ray goes straight if the ray goes straight it's quite simple it's like let's say this is one meter right its piece spends one meter in the glass but when it goes under an angle there comes again this trapping of the light inside and basically now the ray does go double the distance so the glass is actually more green if you look under an angle then if you look straight which is kind of weird but that's it yeah I have here I have just recorded an example of applying this these things to a model of one artist I hope he's not angry with me but I noticed like that there are some things that could be fixed on it and oh no it's not yeah it's like this okay sorry it plays now yeah and in the first moment you can see that there's a lot of blackness in there and I first tried to I try actually not to fix it with the rays I somehow in this live session I I tried to set up the rays but I just increased it to total 24 because that's it's also not good to have 24 rays in your if you were in interior this is exterior light it does again so that I can show it but yeah the first thing is that the artist didn't add these loops to the edges of the table it was just a plane that that has a solidify modifier and some bevel at it but like just the shape of the glass which wasn't visible and the normals that it generates was really spreading this black like spot inside of the table and now even I added the loops you can see it's limited to the side now I will just use some preset that it's already this is already this in it and basically this is the same preset I used before it's just that after 12 rays or 10 I don't know like this setting just below your radar setting so that it can get out the ray becomes green and then you have this effect that with the glasses is really like lightweight considering like the effect and you don't have to because I saw for example some tutorials where people said okay if you want it like this then from the side made another material and make it green green glass okay and here you don't have to care about it you can just apply this material to whatever I want so I like just tried to here yeah okay I forgot to say this preset has one more thing and that is I hope I'm sorry I'm really not able to do live sessions so I recorded this because it's for me too hard to talk and do something on a computer unlike like Sokolovsky who made the previous lesson and he's really good at it and can do everything like this and here you can see there is also some volume absorption added and that is again because this effect would stop working if you look straight on the glass and in the animation you might get over this border and there still might happen some little jump in the shader if you animate it so maybe there could be some blending in the material but I wanted to keep it simple for this for this lesson okay I'll just make it a bit faster yeah and and here I wanted to show I just try to apply the same thing to to another object in the scene just to test that it works that you can see that the glass again looks quite good I'm not sure if it would be that green even it's such a small plate but it has its limits but it's a nice trick I think okay next topic is architecture glass if you have been to previous lesson then there was I think like 10 ways how to do architecture glass so this is just one of them and its repetition if you saw it already again like the theory behind is this again the same thing here that if you have this ray like on the other side of glass it continues in the same direction so if it's like if there was no reflection at all of course if the glass is manufactured perfectly so if you want to go for real realism there are some imperfections especially in on glass because the glass flows like a fluid so 100 old glass will be really banded but if you if you take like the perfect glass for actual visualisation the ray on the other side continues just the same just one millimeter to the side or something which is really not visible so that's why it's safe too sorry the presentation got stuck somehow yeah and the the fresnel effect is there again oh yeah okay sorry the representation didn't work out like I wanted but it's easy to skip the glass completely and that's where you use only fresnel and glossy effect a glossy shader yeah same like like showed one hour ago and you mix it with transparent so what goes through is transparent and that's saves computing time and this is what I have a bit different that I also made some other like conditions for light rays that I subtract from the fresnel if it's a shadow diffuse transmission reflection ray and based on the rate depth which is on the rate depth it's this multiply it's this multiply box you see it it's where I multiplied the rate depth by 0.1 or 0.2 so if there would be more glasses behind each other each each would be more transparent which is not realistic and maybe not good but if you would have a scene where there are 10 glasses behind each other then it could like be really hard for cycles so that's it and yeah that's end of the presentation I'm not sure what is the time because I yeah I think I wanted to make a little live session about dispersive glass which is like really different topic I would use it only for jewelry like and sincerely like the animations I showed the ones that have these refractions were done with Luke's core which is much better with caustics and if you would want to render the jewelry like this specific case with dispersive glass I would go this way probably because Luke's core I was surprised myself but it really moves forward you just install the plugin and it takes cyclists materials and is able to use them to some extent not all the procedural nodes and stuff but if you go with textures and simple stuff then Luke's core can do this job but I wanted to show this it's called dispersive diamond shader and it's not glass it's diamond because I sincerely don't know where yeah there might be cases where it's good for glass but so I think I will try to do this material from scratch because it's better to to see it how it's created let's hope I don't forget if I forget something I can help myself again so so I first do an RGB core input because I will show later why and I will try with converters to separate RGB and that's how we fake the dispersion in the glass that first I do separate RGB and I do combine RGB this is the most lightweight way to do this like to get actually three colors from one I guess because it's just switching the channels no no mouse in it and now I have this color input that I make white as I said two three colors and I now can get three glass shaders it's quite heavy because there are three shaders in it so sorry and these shaders get added together because we split the color so we will combine it back by adding something comes out but I'm quite sure it will be just the normal glass because now we need to change in the scope of refraction the point is that index of refraction for the different color lens is different so but to make it guider blues where I have to set the three shaders separately I will make some values for this where did it fly sorry okay I added again it's around 2.5 for a diamond and I also make another input for the amount of dispersion which I tried before and 0.05 is okay and I also make another value to drive the roughness of the result which I will show you later why this is needed okay now the first is my IOR and I want to take this IOR three times one for red from green one from blue and I want to take the math mode so for red I will subtract this basically the ref this difference in the dispersion and for the blue I will edit and now so the first value goes to error if I'm correct the second value is the basic value of IOR it's the middle and the third value goes from this opposite yeah subtract add and the middle they all go here to these shaders okay let's look how it how this looks now and I can see okay there is some dispersion happening but the whole thing renders slowly and it's very dark so here I in this case I recommend too light to do cycles a bit about the physical properties of light and to put in 1.05 into the color or maybe even more and yeah with this material I also found out because of cycles let's say it but also another ray tracers the roughness of 0 is not good because this will just create and less noise so I try to connect the roughness value and it also makes the whole thing much more shiny sincerely I don't know why but increasing roughness makes it get more light out of it like it's like with the mirror material in cycles like if you make mirror it literally reflects nothing and it throws no light okay and yeah yeah 0.05 is fine for this and this diamond looks okay yeah okay that's it oh I think yeah it's half an hour so it's nice are there some questions yeah let's try I didn't yeah it works yeah if I can make it lower the highlight not outside but only inside like like yeah I I didn't try it so that I would get lost here but probably after some race like to tell hi after one or two race it's different like it's so so like this or maybe also like art a shader it's sometimes good to you know like make for example have the same shader added to itself like that's what I also use sometimes it will ruin the setup but let's say that I say if the rays are higher than two I can just I can just do this and then you can use the same shader computation you don't make more shaders and make it more heavy and then you can basically make also this math higher and sometimes you know you can reuse same computation from the shader okay that's it thank you very much