Intro to the 3D PBR Material in Godot (Spatial material tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to look at materials and the spatial PBR material that go to three onwards ships with we're going to look in particular at the most important parameters so albedo metallic roughness and the more advanced ones with welcome in a future video on the topic I'm not going to provide a base project here I invite you to head to CC 0 textures calm while you can find high quality textures that are in the public domain so you can pick any material that you'd like invite you to use this one because it's very interesting in that you not only have the textures but you have a preview of how the material is supposed to look like and the way you set of materials in 3d in the editor like that is you're going to try to make them match either a photograph that you use as a reference to reproduce a real material or in this case because the artist has kindly provided us with a really nice render you can use that as a reference to set the parameters in Guto because depending on the engine the exact values that you are going to use are going to be different they don't scale exactly the same way for example we can download the 2k version of a set of textures and going back to Godot you will be met with a zip file that contains a texture with the name underscore the version the variant of the materials texture that you're going to plug into the material and good else you have color Afton color normal map roughness the base ones and sometimes you will have ambient occlusion displacement or metallic so let's create a new scene where we're going to set up our meshes I'm going to press ctrl 1 to have only one view in the viewport a single viewport we're going to click to create a 3d scene here and we want to add a plane and a sphere to test our material so press ctrl a to add a new mesh instance and with mesh instance you can create basic meshes in good Oh head to the inspector on the right click the slot on mesh you want to go down to new plain mesh we're going to scale it up because it's a bit small by default press ah to toggle the scale tool and click the square that's green that's going to scale the x and z axes then we want to go back to the spatial node and add another mesh instance we're going to create a sphere this time so go to the bottom of the list is fear mesh you're going to move it up so it sits on top of the plane W to get the move tool and control click to snap and move one of the axes so you click on the arrow here and ctrl click to move it up there we go so we have our two meshes let's rename them to plane and sphere to keep things organized and we can get started with the materials so let's click on the plane to select it and you want to unfold the material category and click on the slot empty to create a new spatial material the shader material is one that you will code by yourself from scratch pretty much and spatial material when you create it and click on the material you will be met with a long list of parameters and these are all the B SDF properties all the properties provided by pixels B SDF shader it's a very complete type of material that was designed by Disney Pixar and that is used in some 3d programs including Godot we will ignore the flags vertex colors and parameters for now we're going to focus on what makes our material look like something nice in order to proceed from there you should have some textures somewhere in your project downloaded from CC 0 textures come and put in there note that I've downsized mine so there might look a little blurry at times but this is so they import andrian port much faster for the video I'm going to work with the ground material here that I downloaded one with leaves to unfold the albedo category an albedo represents the color of the material until you want to drag-and-drop the color texture into the texture slot here in the previous generation of game engines and rendering algorithms you had the texture called diffuse and diffuse would represent the color the material emits if it was lit by pure white light but the models the lighting model at the time was much simpler so now it's called albedo and it doesn't represent exactly the same thing the albedo is going to interact with the other parameters of the material to return the final color if we go look at the texture itself it doesn't have much light in formation it looks very flat and in the past you might have used a bit of shade inside the diffuse texture to fake that lighting but not anymore so we have our base color here from that and notice one thing it's that the texture is not blue but this the ground looks blue and that's one thing with when you are working with PBR the environment the procedural sky that you have by default in Godot is going to affect every object in the scene and every material we're going to add a new light just a directional light to represent the Sun so that we can see how a material looks a little better so select the spatial node press ctrl-a and you're going to search for directional light now by default it points to the right let's move it up a little bit and we're going to rotate it so press the e key and rotate the nodes so that it points down and you can see that all of a sudden our ground looks a lot better all right so let's select the plane again and go into the material now to make it easier to edit the material and to edit while we select objects on the scene we're going to go to the little wrench icon in the top right of the inspector go save our material as I'm going to call this one ground I'll save it at the root and that way we can anytime I can fold my textures double-click ground the file here to open it in the inspector and it will still update in the viewport the next parameter we want to look at is metallic metallic is going to define how much light the material reflects every material in the real world reflects some amount of light now when you crank up that value it's called metallic because the object is going to work a bit more like a mirror so note that metallic and roughness interact with one another so if I lower roughness to zero the object is going to reflect a lot of light and what essentially act like a mirror is I'm going to work for our ground for our lives because leaves don't work that way leaves will have a low metallic value the specular one most of the time you don't want to touch it it's a bit technical you you would offset it to achieve special effects and that's about it for now we can leave the metallic value pretty low and increase the roughness in the case of our leaves the roughness represents the amount of details and nuts and crannies that's a microscopic level there are on the object so when a surface is very rough it will tend to diffuse light so you won't have a clear specular light you won't have a clear highlight on the mesh something like leaves and dirt or for example if you take rocks they tend to be pretty rough materials and polished metal or a mirror for example will be not rough at all so you would take the value down a lot now you can see we have texture slots in metallic and roughness and they allow us to control the materials roughness to weigh this value because right now it's applied to the entire plane making it look very flat but if I take the roughness action drop it into the slot and increase the roughness now it's not as uniform anymore so you will see in a moment this makes some parts more effective than others now at this point it doesn't look outstanding but this is because you need all the textures to really define the material and get the wanted result so we have to add the normal map and the displacement map as well for the material to look good the emission we're going to skip right now it's how much light the object emits so you can turn an object in a static light if you want by turning a mission on which we don't want forever our ground and we'll see in the future that this only works if you are using global illumination it's not going to cast shadows for example now normal map is going to add details it's going to fake the volume of the object so let's enable it and you need a texture for the normal map to work so this texture contains data that represents the volume of the surface so how different parts of the material are oriented in space one thing I've noticed from CC 0 texture is that you need to use a negative scale to get the right direction for the normal map by deform the shade will be opposite from what you'd like so you can toggle the normal map on enough to see how it starts to give you some bumps on the object and you can change the light angle to see the effect a little more clearly now I'm going to set the scale to be higher than that -2 to accentuate the effect and you can see how it gives us lots of bumps and small details on the object I'm going to do one thing because you can see the texture is little blurry maybe on your screen it definitely is on mine I'm going to open the material and go down to the UV category and UV represents how many times you're going to put the texture on the mesh if you you've seen taxi um you've seen belts taken from animals UV is the same idea with 3d meshes you take the mesh and you unwrap it you unfold it on a plane and this allows the 3d program to map your texture onto the surface for a plane it's a square it's going to take the entire texture and map it on the plane but obviously on a sphere or a character it's quite different you can't do that now we're going to scale our UVs just on the x and y axis to make our texture cell into the object and that way we don't have the lack of details we had before and the texture already looks more convincing should I say the material rather after the normal map for this material we have a displacement texture so we're going to move on to that I'll skim over rim and clearcoat rim is going to simulate clothing especially surfaces that are velvety like silk for example it's going to create some backlight on the object we can enable it if you want to see that so it's very strong on this one by default but if I lower the rim effect you can see how it creates some backlight on the ground and you can use it to make a character pop from the background to fake some light coming from behind the character from all angles then clear coat clear coats is a property that you use when there are two layers in your material I invite you to read the little tooltip here but for example on cars you might have the paint and you have a layer of transparent material on top of that that's going to trade a second specular reflection on the object so you want to use clear coat to get that secondary specular light and is ultra P is then a parameter you use with metal it's going to lengthen the shape of the specular highlight depending on how you use the property but you use it often on brush metals for example to get the highlights to look like how they look in the real world ambient occlusion we'll see that in a second screen to Duncan the cavities in the object but we need a texture to make it work then depth is quite interesting this is a property that allows you to fake geometry on the object so it's a bit like the normal map except it's going to give more depth to your object and you have displacement maps that you can use in the textures from cc0 texture so let's drag and drop it into the texture slot here you will see the pixels pop down pretty suddenly and if you move the camera around it's going to look all mushy I don't know why this scale value works this way you can consider it like a small bug or UX thing to tweak because it's way too strong by default now you can activate the deep parallax to soften the effect and also this is probably a little more performance intensive it's going to sample the texture more times to apply the effect on screen because this is a pixel based effect well faking depth on the object so note that all these properties like using the depth for example has a small performance cost right but if I disable it and enable it again you can see how it gives a bit of depth to our material so I'll zoom in to show you how it works now again you want to use a negative scale often with the textures from CC 0 texture you can see that right now we have gaps where we have the leaves and it looks very weird so let's use minus 0.05 to have the leaves bump up this makes our ground little more believable you can see that as we move the camera the leaves feel in 3d although they really are in 2d so as you can see with this effect the more parallel the camera gets to the surface the less believable like it starts to break a little bit so use it in complement to the geometry of a terrain for example to emphasize the bumpiness of the ground but you want to measure like to use this effect sparingly you don't want the scale value to be too too strong now I've seen the basic parameters on that I just want to show you quickly something we'll talk about in the next video but how lighting and the environment are very important for how the materials look so first when you select a light you have to tell goodö that you want it to cast shadows because shadows are performance intensive in games don't want all the lights to cast shadows I'm going to enable the shadow on my son and already the scene looks a bit more believable with the sphere sitting on the floor then all 3d scenes use an environment resource that's as good Oh what are the properties of the sky what the objects should reflect or not so you have to enable lots of these processing effects for the objects look as believable as they can all you can tweak the settings to trade performances for realism on your objects now I've prepared some metal to apply to the sphere and if I drag and drop it here you'll see something strange happens it's very dark at the bottom and the reason for that is that right now it's not reflecting the ground instead it's reflecting my sky so I could hide the plane and the metal would not change at all it's not reflecting the leaves under it and this is controlled by the environment and by default Godot creates a default and the score environment resource that is going to apply to all the scenes where you did not override this environment because you want to change the sky and the environment that your objects will reflect for example per level in the game so let's double click on that resource and I'm going to go to SS reflections screen space reflections and enable them and from there you will see that now my metal looks quite different it reflects the ground so this is just to tell you that if you aren't just watching this one and getting started and you get some fishy results this is because you have to not only prepare good materials but you also have to create a good environment and the modeling and the textures everything works together to create the game's final look and but that said I want to thank you kindly kindly for watching be creative have fun and see you in the next one to talk about the environment in good
Info
Channel: GDQuest
Views: 33,331
Rating: undefined out of 5
Keywords: godot 3d tutorial, godot 3d demo, godot 3d material, godot pbr material, godot 3 pbr, godot pbr tutorial, godot spatial shader, godot photorealistic, godot textures, godot material tutorial, godot tutorial for beginners, godot game engine, game creation tutorial, godot engine, godot 3 tutorial, godot 3 3d tutorial, godot 3d tutorial for beginners, godot game engine 3d
Id: LXnW6WL7cSE
Channel Id: undefined
Length: 17min 58sec (1078 seconds)
Published: Mon Jan 28 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.