High Quality Water For Blender - Cycles - Blender Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello youtube so earlier this week i put out an animation um i'll probably be showing it on screen and it involved me having a truck sitting in the middle of kind of a beach environment and well one thing that i found very interesting a lot of individuals who saw the render found very interesting was the water at the beach um and i was looking through it and i found the water i used was i had actually made a very interesting note material setup for it and i figured why not show how to make it so really what i'll be showing is how to create water some really interesting looking caustics caustics are not a strong point of the cycles render engine and i still found but i found this shader to be relatively performant and honestly once you get the node setup especially with blender's upcoming asset browser functionality it's really really not as bad to implement as you would think so why don't we kind of jump into it then um what you're going to see is right now i have a blank blender project set up or not blank but a basically two planes this one will represent our water this one will represent our basically underwater area i just used a texture from mega scans for this so first things first well we should be in the cycles render engine set i set to gpu compute and of course we want to be using the experimental tool set for some adaptive subdivision which we'll kind of go over later so let's create a new material and call this water so first things first we actually want to get rid of our principal bsdf and we also want to do another thing we want to give this water some volume so i'm just going to use a solidify you could also just import a cube and now that we our water has some volume well first things first why don't we just give this a nice volume of absorption shader so this volume absorption will really just kind of serve too well you know take a little bit of the edge off when we are or give this water a little bit of appearance of volume as its name implies and i just generally set this to a nice blue you could really set this to whatever color you want i wasn't really concerned with a figure physically accurate color i wanted to the render to pop a little so from there well let's think about the best material that we could use well a good material to start off with for a water material is well of course the glass bsdf again this only works in cycles so our glass bsdf is now in and i'll actually turn on optics denoising just to make that render a little look a little better and we actually want to set this to 1.333 you know you keep repeating that just to set it to the index of refraction of water or basically a measurement of how refractive the material you're dealing with is and having a physically accurate color is important for the shader to look correct i also set this one to a little blue once again not strictly necessary i just like the color to look a little poppier so from here well first order business is i would say to get our water bumpy so we can just plug in a simple noise texture into a displacement and out into the s the height output i like to change this world space it makes it look a little better and we can plug that into our displacement so one thing we'll notice with displacement right now is well number one we're actually getting it's not looking geomet the geometry is not actually there it's just basically being faked by the renderer so what we can do is well there are two things first things first we actually have to go into our material settings and i like to set this to displacement only and not much is going to change this is because we also need to give it some geometry to work with so in this case i'm using a subdivision surface set to adaptive subdivision and now all of a sudden we have bumps i'd like to take down the scale to this just to kind of make it a little more realistic so once again you're going to kind of notice that well we have a pretty good basic glass shader but the water i think needs a little more bumpiness so what i'm going to do is i'm also going to to make it so i don't have to subdivide too much i'm also going to plug in a little bump shader or a little bump map into our normals and i'm going to plug the height directly into here i can then scale this down a bit and we end up with i'm not sure if it's particularly noticeable but we'll basically end up with little bumps i can actually scale the texture up a little bit and add a little more detail to make that a little more apparent you kind of see it now so from here we kind of have a really decent well water shader it looks like water but there's none of that nice caustics interaction going on under the surface which is fine if you're doing a deep water situation but when you're starting to have to deal with a shallow body of water having those caustics might make it look that much better so a good place to start for caustics is a nice and simple voronoi texture we can actually use two of them to break it up a little so i set mine to three and eight for my scaling you can do whatever looks best to you and i also set these to the distance to edge method it gives a sharper appearance versus the standard f1 so distance to edge gives these nice clear lines from there what we can do is we can pull a nice greater than so we can pull a math operation and we can basically see if this is greater than in this case 0.01 what you're going to notice is it sharpens up this material a lot and we can copy that over to the next one too so now we have kind of two textures we have two caustic textures that have two varying levels of noise well what we need to do is we need to combine them fortunately we can just pull a mix rgb and node in here or you could also just pull a simple multiply node but we'll just set this to the multiply operation and you're going to notice these mix now so next up well we probably want to give this a little noise into how it's basically being applied so i'll just mix in a noise texture set and i'll scale this down um scale this down a little bit and i'll up the detail a little bit you know set it like five or so so from here what i can do is i can then pull another multiply node and just multiply it with this shader you're not going to notice much of a difference but it's subtle and it gives a little variation we'll actually be breaking this entire pattern up a little bit finally we can actually plug this into an arc tangent to value so you might ask why the r tangent two value it's because it will ramp every value super hard on the side so if we actually go into math and we just plug this into an arctan too we can get a little more it won't show particularly well let me set this to 0.59 it won't show particularly well but it's just it's causing a a slight shift in the values to kind of really quickly ramp them on either side just it's how the arctangent function works if you actually take a look at a graph of it you'll you'll see what i mean so next up well we have really a really nice caustics pattern that we can kind of work with now and there's something so we can kind of start getting our caustics in implemented so we have our transparent bsdf that we can map to a value let's say two in this case and what this does is this actually makes it almost emissive in a way it makes it still transparent but it kind of gives it a brightness value while still being retaining its transparency from there we can just mix this with another transparent bsdf i have node wrangler enabled that's why i'm able to do this and we're actually just going to use this is the factor so you're actually already seeing this kind of caustics pattern being implemented now on our surface but the one thing else we want to do is we actually just want to do a another i'm sorry a another value bump plugged into here we'll actually just duplicate this entire node setup and we're going to set this to negative one which if you don't know will look like this fill with black but when we use an add shader it will basically subtract some of that emission away which gets a little important later so now we can start doing some fun stuff where we mix this ad shader with our glass shader that we implemented earlier once again that plugged into the displacement i do not know why so if we plug these in we're going to notice we get a weird kind of patterning here it's because we've plugged our displacement in so now we kind of have our glass mixing with our well with our you know cost our fake caustics shader um and overall it looks decent we'll we'll be messing with the scaling values of we'll be messing with the scaling values of these voronois to make it look a little better later so from here we can just define where the caustics are going by changing this mix shader right now it's just a zero one value to a light path which just basically says okay is this a shadow ray in which case it swaps it to our next shader and this is where you're kind of able to see well now it's moving to an actual caustics pattern that's projected on the bottom and it actually looks fairly good already you can already see the bump texture if we actually mute this is having a bit of an effect and the displacement texture too not sure how apparent that is in video but it's it's noticeable so we've kind of really set this up but i think we need to apply a little bit of well transformation to our to our you know caustics pattern because right now it still looks very voranoy-ish so what we can do is we can actually add a mapping node and map every one of these and we'll actually oops i think it's this yeah and we can map every one of those to a through its own kind of separate one we're plugging this into a um we're plugging these into the same shader you'll see why it actually because we're going to be doing some transformations on our caustics pattern um just by exploiting the mapping node so what we can do it to do that is we just plug this in but i use the linear light blending mode it's not going to look like much at first but that's because we haven't mixed it with anything we actually want to mix this with a noise texture and a map range oops i did not need to duplicate that the map range basically just allows us to specify a a smaller ceiling value you could do the same thing with a color ramp i just like the how the map range the map range just makes it look a little cleaner we'll just set some values these are largely arbitrary you can tweak them to the however you would like we can plug this in and already you're kind of noticing we can actually scale this value down adjust our caustics but what it's basically doing so you know this starts looking good is it this is using this mix rgb to mix this vector input and this map range input into a separate vector which you see adds some noise to the transformation so it's basically telling the shader that this point is actually over here which gives this is really kind of breaks up this voronoi effect and makes it in my opinion look a fair bit better so believe it or not we're actually a large way a large bit of the way there i also set this to object shading we're actually a large bit of the way there on our shader um in fact if you're just doing a still render um there's not really much else you need to do here this is you know you you could you know tweak some settings call this render you know hit render on this and call it a day um but i think we could i think we can do a little more on this and that's where we can really start dealing with well our shader tr are the same concept of shader transformations we're basically affecting our axes um in this case let's say we want the water to flow like we did in the animation so what we can do this by simply giving this adding another texture so right now we have a we have this set to a certain value right set from our object coordinates but we can actually split this vector out by separating the x y and z components of it and we can of course combine them again but this gives us individual control over the x y and z transformations so we can choose to individually affect the x y and z depending on how we want to in this case i affected the x in the animation so right now it's not going to look good that's just simply because right now it's saying there's no x data so it's going to look quite odd so first things first what we can do is we can just chuck in a nice little add sorry math it's a map node but set to the add operation and as we kind of see it's going to be the same shader for now but if we adjust this value it will shift the water it basically shifts it over and so we can do is if you haven't guessed we can map these to some well relatively different values in this case i used a musgrave texture so if i use a musgrave texture i use two actually we can actually set these to scaling values that look good so for example i'll actually just plug this one in right now you can actually see how we're affecting our little shader here so in this case i set this to you know and the actual animation i set this to 40 that's probably too big though in this setting um and i also set this to a multiply um i could also pull a map range in there actually i'll do a map range here so what we can do is we can actually set this to have less of a value so in this case let's say i wanted to set this to 0.2 it's now at 0.2 percent of the intensity and just to show you that it works we can also do a math multiply and 0.03 and from there we can actually multiply that by a smaller value you're actually seeing the effects of that so in this case i still think that scaling value is a little big so i'm going to take this back you know a fair bit of the way maybe two it's all depend on how you want one way you can actually look at it is this way and you can actually see how much it's transforming each vector by so i'm actually going to do this again i'm going to duplicate oops actually i only want to duplicate this one and i'm going to map this one to a smaller to a smaller to a smaller size so maybe one in this case what we can then do is we can you know have the same multiply node and then we can do another math node that will sample the maximum value so basically it'll take the greater of the two values right to basically perform that transformation i think i should actually scale this up a bit just to give a these are this is kind of your ripple pattern in the water this also allows you to see how this kind of works so from here what we can do is well we'll plug it into our value and we'll preview our shader real quick you'll see that looks fairly decent and but right now it's still not animated all we've done is distort the water and this is where we can finally plug it this into a mapping node and this is where the last step is is all we do is just give this a driver so you know hashtag frame um the hashtag in front is just to show that this is a driver and frame just is the variable that defines the frame of the animation and we can just do in this case i think in my animation i did over 10 000. now this is a really difficult value to change to dial in um and the reason is that well it's difficult to preview in real time as you're kind of seeing this render kernel or this render you know this rendering it takes a while to update so a real-time animation really isn't that amazing and it doesn't work with eevee so that kind of becomes out of the question so really my advice for this is to tweak your values until you get something you're happy with that's really all i can say about that is you have to kind of you know it's it's a lot of value tweaking until you until you reach a result that you like so once again you know we can we could you know we we can do a whole lot with this we could also plug in another math node here you know set this to a less of a have less of an effect so in this case you know maybe 0.2 and now this is a if we actually mute this add node see you can actually see as a little bit of an effect all right see it just lessens the effect of this caustics so but all in all this is our water shader finished um this is really all you need so it's a pretty big node setup but each part can kind of be broken out into its own chunk so for example this is the caustic um this lower bit is the caustics section this is the most complex section this is the surface setting and this just controls the mixing of the caustics all this stuff over here is just some mapping stuff to make it so we can animate the water once which once again if you're dealing with this for a still animation really isn't a huge deal so that's really all i have there's you know so much you can do without shaders and blender and this is just a tiny example of this my advice is well just go and you know make the shader and then start iterating on it start trying to improve it and feel free to use it in your renders so aside from that that's about all i have for today so as always have a nice day
Info
Channel: Hayden Gray
Views: 25,960
Rating: undefined out of 5
Keywords: blender, cycles, cycles-x, cycles x, caustics, shader, material
Id: 6LIEUQ-tTHw
Channel Id: undefined
Length: 19min 50sec (1190 seconds)
Published: Sat Sep 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.