Unity 2018 Shader Graph - Tutorial 07: Reflections

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys I'm Dennis respect studios and we're going to continue the tutorials for the shader graph and in this one I'm going to show you a little bit more about reflections and how you can do nice static reflection with shader graph and without actually having to use the reflection probes in the in the build we're going to use them to generate a mob but we're not going to use them to in the build so let's start with new shader here share graph let me just take this I'm going to delete it I'm going to duplicate this and I'm going to name it shader graph zero seven let me delete absolutely everything okay now first of all to be able to see a reflection let me create one sphere like this you have to make cube map so I'm going to make a sample cam map I'm going to move that into the emission I need a cube map for the reflection for now I'm going to download now if I open Google in the type cube map I'm going to download the first image this is it I have downloaded it and it's inciting it here so when I when you import it it's so yeah imported you have to keep the texture type to default and the texture shape to cube this is how it's going to look like when you do that it's going to make a sphere which will look like it's reflecting something let's place here on the cube map and open that sphere and now you can see that if I select the color and make it black and hit save we are going to see let me just select material 7 if you don't have just create a material 7 and apply the material to the sphere and now you can see that the sphere is having a texture Muppet on it and it looks like it's reflecting something but not exactly because if I rotate it it's rotating the reflection that doesn't look right ok what we have to do to make this work it's actually we have to take the normal direction which is the normal vector and the hoop output into the normal of the sample cube map and then we have to take the view direction and hook that into the view Direction here so if we save here second you can see now that now it looks a lot better now it's look like it's reflecting something ok if we scale it for example like this looks like like reflectix I think okay we can make one property which will be float and we are going to call it let's just call it blur reflection blur and it's a if I'm going to create one property let's choose a reflection blur and let's hope that here hit save and now if you select the sphere and you go to the shader you can start increasing the reflection blur and you're going to start getting this now you see how you still have reflection but it's getting the sample like it's a map map so we can make that you can hook that to the distance you can make it as far as I'm concerned if you make that to be like this it will be less if you expect less from the device that the game is running that the project is running so let's keep that for now to zero now let's say that we want to have a reflection in our scene and not external map for this I'm going to select I'm going to get that house and spawn it two times like here then you can spawn any object you want just make sure that you're following the steps let's make it like this okay I'm going to select all of the four houses and the floor and I'm going to come here and just make them reflection reflection probes static so now I will hide the sphere for a moment I'm going to make empty game object and I will add a component which will be a reflection proper make sure that you go to the lightning if you don't know how to go just go to window lighting settings and turn off how to generate for a second on the reflection probe we're going to make the resolution to 512 and the near I'm going to set it I'm going to leave it 2.3 but the four I'm going to make 200 no need to keep it to a thousand that's too much let me close the shader graph for a moment let's hit bake just wait for a moment to generate the texture okay now if you see here we have this the same type of cube map that we have J we have downloaded from Google and if we go where the scene is you have to save your scene by the way somewhere if you go over the scene is you have folder that's name at the same way as the scene so here you will have the reflection prop now what I'm going to do so I will duplicate that and when Kate I'm game I'm going to get it out of the folder let me delete this one and I will delete the main zero - I don't need it anymore I would select the reflection group I would delete that I don't need it I have the cube map collection cube and that might break it no it doesn't okay perfect let me put that into textures and now if I open the shader which is here should I don't need to open the shader oh yeah I need I can select here and select a reflection cube it's safe and now our sphere is going to reflect these houses all right and of course this is static reflection if you move it it's not going to take into account the movement but it's for static object in there are no it's just a simple texture you can of course the make that look like make it like one you can make it to be to whatever now the thing is that we want to be able to get the texture from here so to be able to do that we have to actually add one property which is a cube map and let's name it the reflection let's grate one property here and choose reflection and apply that in save let me choose that safe okay and now we can choose what reflection we want to use alright now we can do some like set up here for example we cannot for no effect because this is how the reflection works in real world like this and let me first actually let me multiply the Ferno effect with a property and let's make property here let's choose that for now add that here and yeah that one and let me just type preview just to see how it's going to look like oh actually no I'm going to multiply that here okay one and even the thing is that normal in the direction normal direction if you directions okay okay and we just have to add color to this because we don't want to have black here at the middle okay and domestic so we have to make a add note and actually make another you know we don't want that here let me just add that with one so take that and apply it here okay you can type point two point five point eight point 25 all right yeah so we can actually multiply this with a different goal to be able to get a better result of that effect which we can make multiplied for now with another property which I'm going to call for no intensity let's make a property here and apply that oops right here and let's take the multiply and applied here now we can make the for now intensity to be two or five for example in at the center we can make it one or two zero point five or twenty seven twenty five hit save now the center is going to be point five and this is going to be like 3 in this is how it's working ok now this should not be yeah so this is pretty much how you can make the reflection for static objects now you can play with it and make some interesting result you can multiply the end result with a color or even with the texture but you can actually make a texture sample in just take a simple texture and apply it into the Obito the thing is that think we should oh now we have here this is a new version by the way now I can select the nodes which is great emission and you can see that the texture is very visible so if we change some values here it doesn't worry about week what we can do is actually we can multiply oh let me just reopen it we can just like that with the texture but I don't think that this will work actually because we have let me try yeah that doesn't work it does work but if I remove that and just keep that to the emission yeah the texture is visible but it's just barely visible okay so we can go for no intensity it's actually the one I think we can make the powder is that this is just too much okay and as a final result we can just make one multiplying auto right here and actually make an intensity actually we don't have to do that zero emission actually I think okay yeah let's make I was trying to I was testing something let's make a multiply node and connect that here and make oops yeah I did I shouldn't have to you know for no intensity let me just that's nice you just delete this one when your intensity let's make another float which will be reflection intensity let's hit save and we were going to make a property here which we will surf action intensity and multiply it with the actual and multiply not of the reflection and if we got that here you can see now that we can come can control how much of the reflection we can have solid Apple it's at zero for example and if we add that to 0.25 and 2 you can see that is getting more reflection advance now of course you can play with this you can change this from overall to view which will produce some nice results think of the yes changing some of the fix anyway you got the idea of the reflection I just wanted to show you how you can use how you can create a cube map and make reflection without actually keeping the breathe the reflection problem thanks for watching and stay tuned bye
Info
Channel: Respect Studios
Views: 45,453
Rating: undefined out of 5
Keywords: unity3d, editor extension, editor, extending, menu, item, window, gui, guiLayout, rename, object, gameObject, editorwindow, custom, inspector, button, field, game development, asset store, tool, workflow, programming, C#, write, code, develop, dock, utility, vector, content, layout, tip, trick, engineering, build, pipeline, 3d, 2d, dissolve, reflection, blur, refraction, mirror, transition, shader, fresnel, effect, graph, material, render, preview, tiling, offset, alpha, edge, flow, outline, animate, node, based, connect, remap
Id: 943P0dGR4rQ
Channel Id: undefined
Length: 17min 42sec (1062 seconds)
Published: Sat Jan 27 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.