Unity Shader Graph - Rock Moss / Snow Shader Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up guys welcome to the tutorial number four of this series Jimmy T Sheila graph I hope you had some amazing holiday and I hope you have an amazing year as well and today we are going to see how to create stow masks and even a wet effect with this shader that's right guys this is an amazing way of rapidly generating some kind of material accumulation on top of rocks on top of ours or roads or pretty much any object that you need and by the way guys this is a Laval my patreon page and in case you're interested in supporting me you will get access to a lot of visual effects assets for your game links in the description so let's see how we can create this shader and the first thing we are going to need is a PBR shader that we can rename to rock mas for example and then we can double click it to open in telegraph and once we are in chat a graph you can leave these options as they are like metallic workflow pack surface and alpha blends now this channel requires a few textures to work out and a 3d model so we can test this and in case you need resources to follow along this tutorial have made available for free in my patreon page these rock models the moss the snow and the rock textures as well links in description now back to shader graph the first two textures we are going to need are the rough diffuse and the moss diffuse let's add it by here in the properties panel and we can rename it to rock the fuse and mass diffuse and by the way guys these are just names the rough diffuse could be your character diffuse or roof diffuse and the moss could be snow or wet texture it's just a label anyway let's drag and drop both of these Texas to around here and create the sample texture too deep that we can search with spacebar key just like this and we can also add another one for the mass defuse too and as you may notice the mass is going to influence the rock defuse in this case which means we need some kind of wrenches some kind of factor we need an interpolation and we can use alert note spacebar again to search for it and add it and dark note will let us basically interpolate between a the rock defuse and be the masked fuse let's just choose the stone texture for the rock defuse and assign the mass texture to however after you connect them we still have this t option left open and let me just add a vector one to show that zero is the rock diffuse texture only and as we start progressing towards the value of one it will work and it will interpolate to the moss texture as you can see and it is quite a nice effect but this isn't enough for what we are trying to achieve so let me just remove this vector one and let's come to around here to create a normal vector this node will give us a normal vector according to the space selected in the drop down low and I will show in a moment what this can do this is bearish shown then explain but for now let's leave it as world the next most important note is the dot product here's a good representation from shader forge node wiki of what the dot product does which I will also explain in a moment what it does let's just connect the normal vector to be and let's also add a vector one that we are going to call up note or up value let's switch it to a slider with zero for the minimum and one for the maximum and let's set a default value of 0.5 now connect it to dot product and connect the dot product to the lerp note and also connect the Lert to the albedo all right cool and let's see how this is going the inspector but first let's just add this shadow to a drop down low so things get more organized and in my case I'm going to rename this to GAAP underscore SG let's press save asset and let's press right click in our shader to create the material and now if you come here to this drop down menu your shader now is in another drop-down know that you name it which is cool right all right so let's just create a sphere to see our shader is coming up and we can drag and drop the material just created to the sphere and yeah we have these small artifacts that we are going to solve in a moment anyway now we can start seeing the dot product in action it's starting to learn between the rock and the moss texture and basically the dot product returns one when both of the given vectors are in the same direction and return zero once they are perpendicular so all the values that goes between zero and one will let us control the amount of blend between the rock and the moss which is what is creating this havoc and that was my attempt at a simple visual explanation and now to fix this glitch within a clamp node so that we can limit the output values of the dot product and we can clamp to a minimum of zero and a maximum of one it should be fine so let's replace the alert connection like these and that's it that till glitch now is gone we don't output any negative values anymore and I also want to show you what happens when we switch the normal vector to view and the effect now it's quite interesting the mask will follow the point of view which in this case it's the camera nice stuff and the world option will make sure that the mass is always on top it's always facing the normal vector of the world as you can see however would it be cool if we could control from which side the mass or the snow starts to grow well that's as simple as multiplying the normal vector output with a vector tree that we can add here and call it mass offsets let's drag and drop it here and add a multiply node so we can multiply it with the normal vector and replace the dot product connection and if we save this we can go back to the inspector and we have a bit more control of where the position of the mass is going to be which is quite useful and cool for example it's useful for when we want to make sure that the snow hits the rock from this side or from that side off from the backhoe from the top you have much more control now anyway we still don't have much control on the mass or the snow fell off the faith basically and to our mark control over that we can create the vector one that we can rename to level with a default value of one and multiply this vector one with the output of the dot product note like this now this will give us this kind of control like a faith basically and we can still improve this control with the power note let's again create a new vector one which we can rename to contrast with a default value of one for now and let's also add a power node with spacebar just like this and let's connect two multiplied to a and the contrast to be of the power load and don't worry about this pink color for now we are going to fix it in a moment and we can replace the connection to clamp so yeah that pink all that we have seen in shell graph it's really messing up our shader in the bottom part in the lower part but let's focus on the upper part and if you play around with these values you will notice that the level controls the faith and the contrast controls how much that edge is going to be sharp which is awesome and useful and yet we need to limit those values by the way but first to fix that part under our sphere and rock we only need to set a very small positive value on the minimum property of the clamp note something like 0.01 even less if you want and that should be enough to solve this problem anyway let's change the level property to a slider now and set a minimum of 0 and a maximum of 10 which should be enough and we could do the same for the contrast but this time with a maximum of 25 at least that's what works for me now let's save this and head back to unity where we can see that our shading is working well and it's almost done - the only thing is missing is that if this is for objects like rocks correct roads etc etcetera we still want to make sure we apply this blend method to properties like glass and normals at least and it's fairly easy since the art part is done already for example for the normals we are going to need a texture 2d for the rock normals and for the mass normals as well just like this let me just drag this to below the respective diffuse textures and also choose the respective normal maps of the rock and then the moss after these we can drag and drop both texts to around here and select these two sample texts to denotes so we can copy and paste with ctrl-c and ctrl-v drag around here and connect respective textures let's also copied alert note but for normal Maps we still want to control our intent they are so let's create a normal strength note for each text connect them like this and oh yeah sorry let me replace this with the most normal map my bad all right now we need a vector one for the rock normal strand and another vector one as well for the mass normal strength to let me drag it here add another one default value of one like this and connect them to the respective nodes now we can connect them to the lerp like this and all we need is the output of the clamp that we use it for the diffuse and that's it we just need to connect it to the normal input of the PVR marster so that's it for normal maps for the gloss it's pretty much the same process we can copy/paste this sample texture 2d we ctrl-c and ctrl-v add two textures 2d in the properties panel one of them for drop cloth drag it around here and select the texture as well and the other one for the mas gloss all right cool let's connect them to these sample texts of to the nodes copy paste alert node again connect both Texas and also the CLEP output like this and now before connecting left to smoothness input we also want to make sure we can control the gloss amount of each texture and it's as simple as creating a multiply node so we can multiply the rock gloss texture with a vector one that we can had here renamed to rock plus strength with a default value of 1 and also add another vector 1 for the mass gloss strength let me just rearrange this you now we can connect the Wroclaw strength to this multiply and do the same for the mask loss as well just replace the connections to the lab and now we can connect this learn to the smoothness cool and you could do the same for the metallic but in my case I'm only going to create a vector one to control the metallic property like these guys and let's save this and head back to the inspector and all we have to do is assign the respective taxes to their slots like this and we are good to go you can play around with these vowels and adjust them to your own needs to your correct to your house to their role to your object and that's pretty cool right I really like the idea behind of this shader and it can be useful when creating some level design some even some game mechanics and of course for visual effects too it really depends on the final goal you have and you can still make it look like it's wet as you can see all I did was duplicate the original texture of the rock made it darker in Photoshop and replace it the MAS diffuse normal and gloss maps then I increase the gloss strenght and it feels like it's wet it feels like it has been touched by water it's a pretty cool and useful shader anyway guys I hope you have enjoyed studio if you are able to support me my patreon page you can get access to a lot of shaders and effects assets for your game go check it out it's really worth lids in the description and a special thanks to all the patreon supporters of last month that sparked me you guys Rock thanks for watching and see you in the next video [Music]
Info
Channel: Gabriel Aguiar Prod.
Views: 28,197
Rating: undefined out of 5
Keywords: Unity tutorial, unity special effects, game effects, unity game effect, unity shader graph tutorial, unity shader graph, shader graph, shader graph tutorial, unity shader tutorial, unity shaders, unity material blending, unity blend textures shader, unity blend textures, unity material shader, unity rock moss shader, unity shader graph snow, shader graph rock, unity blend materials, unity pbr graph, unity shader graph water, shader graph triplanar, snow
Id: Q43XBychCEY
Channel Id: undefined
Length: 15min 21sec (921 seconds)
Published: Tue Jan 15 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.