Displacement in UE5 | Geometry Script Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] so in this video we are going to use geometry script to displace our meshes so a lot of people have been asking me how you do displacement inside Unreal Engine 5 and there are many ways to do that I mean you can use the new virtual textures and the height field mesh but that is like way too much work and that is also not accurate I mean you are not displacing the geometry itself in that so like this is a very quick and easy setup and I use this workflow a lot in my environment so geometry script is a new feature of Unreal Engine 5. that lets you access all the modeling features in Blueprint this is one way of using geometry script geometry script is very vast and you can use it to create all kinds of different things but in this video I'm going to show you how you can use geometry script to create a basic blueprint which you can use to add displacement before we start the video I would like to thank all the people who support the channel on patreon so thank you so much for your support it really means a lot foreign [Music] Source website that you want I'll recommend this website so you can download any texture that you like now when it comes to downloading these Maps these texture Maps we are going to need all the maps that are required for the PBR workflow so we are going to need the diffuse the displacement the normal which is the DirectX one and the roughness download all of these Textures in the PNG file format so once you have downloaded these textures let's import them inside the engine so you can right click in the content browser and you can import all of those textures so our textures have been imported so this is our color texture this is the roughness texture this is the Norman map and lastly we have the displacement map so after importing these textures let's combine these textures into a material so to create a material you can right click and create a material there you can call it whatever you like so this is the material editor so now let's add these textures and assign them to the appropriate slot so I'm going to assign the base color to the base color slot next we are going to add the normal map add it into the normal slot after that you can add the roughness map and let's add that into the roughness slot we are not going to use the displacement map because we are going to displace the geometry itself rather than displacing it at a Shader level so our material is looking pretty good now so let's close this material so now to access the displacement functionality we need to enable the geometry script plugin so go to the plugins and enable this plugin after enabling that you can right click in the content browser and then you can add a blueprint now rush me when blueprints are involved like people feel that it's really complex but they are not that complex I'll try to explain everything and we are not going to do any programming as such I mean this will be very straightforward so in the blueprints right here in the all classes we are going to search for generated Dynamic mesh actor so make sure that you select the appropriate one select it and created so this will be called Dynamic mesh now you can open up the blueprint after opening the blueprint you can go to the event graph select all of these nodes and press your delete key now you can go to the left here where it says functions and we need to create a function override so we need a event called rebuild generated event so this event is going to be called whenever your mesh is updated you will understand what I mean by this now if you have any experience with blenders geometry nodes this works in a very similar way so basically what we are going to do is we are going to first generate our mesh and that's really easy I mean there's a node for that so if you drag off from the target mesh you can search for append so here you can append a lot of different things you can append a box you can append a sphere so let's open the box you need to compile and save this and if you go to the viewport you will see that we have a cube right here so the node that we added the append box node is basically creating this cube right here so this is really similar to Houdini if you are familiar with that and I feel that having such procedural workflows inside Unreal Engine itself will be a used Time Saver so now that we know how to like create meshes we need to create a plane to apply our texture and to displace the plane so for the plane we are going to add a rectangle and as you can see we have a rectangular plane in the viewport back to the wind graph you will also notice that we have some properties here so that's the scale of the mesh on each axis and these properties will be different for different meshes like if you add a sphere you'll have a radius parameter radio so now what we are going to do is we are going to promote some of these properties to a variable and this is going to allow us to access them in the editor itself so after we have added a plane we need to subdivide the plane right because the plane currently has like only a few polygons and we need a lot of polygons to displace the mesh itself so the search for tessellation and we are going to use apply PN tessellation here we have the property called tessellation level so this is the subdivision level I'm going to set that to 10. and if you go to a wireframe view you can see that we have subdivided the mesh 10 times so if I set this to a lower number you can see that we have less polygons now so we are going to promote this to a variable as well in this node you also have some additional options so if you want to see all of those options you can right click on them and you can split the struct so basically you can like expand all of those options so now that we have tessellated our mesh we are going to displace the mesh so just search for displays and we're going to use the apply displays from texture map so we have the texture right there you can promote that to a variable as well again these are variables so you can rename all of these variables in the variables panel [Music] so basically what we have done here is we have created a rectangle that's the plane then we have subdivided the plane and after subdividing it after tessellating it we have displaced it now one more thing that we need to do here is that we need to set all of these variables as public [Music] let's add this in the scene if you'll take a look in the details panel you'll notice that we can see all of our variables so you can change any of these variables and that is going to update in real time you could also tessellate the mesh so let's do that let's go to the wireframe view to see it better and as you can see you can like dynamically tessellate this so after you have a good amount of tessellation let's apply the material so select the material in the content browser then select the plane and you can click that button to assign the material and you'll notice that we don't have any displacement going on this is still flat so there are two reasons that this is not working first we need to apply the displacement texture itself because currently the texture slot is empty so let's Supply the displacement texture still we are not getting any displacement now displacement strength is a bit too low let's open up the blueprint and in the blueprint we are going to split the advanced options right here and we have option for options magnitude so you can right click and promote that to a variable make it public this is basically the magnitude of the displacement so this is like the displacement multiplier and if you set this to high number you can see that we are getting displacement so now you can use this one blueprint and swap out different materials and different displacement Maps to create and like tessellate meshes in real time lastly we are going to learn how to apply Nani to this and bake this as a mesh so this is a dynamic mesh and this is a blueprint so we can't add Nani to blueprints we'll have to convert this Pros Regional mesh into a static mesh we are going to go in the modelings panel and right here under the transform we have option to convert so click on the convert option we are going to convert this to a static mesh and you can transfer the materials as well down here you can save it in the current folder so I'm going to quickly create a new folder called meshes make sure that this folder is opened after that you can click accept [Music] you can open it [Music] so just enable nanite apply the changes now this is like any other static mesh and you can duplicate this and create your level so this is how you can create a procedural tool and this helps a lot when it comes to like environment order level design like it really experience up your workflow so as you can see displacement adds a whole another level of realism to your scene so yeah that's it I hope you learned something in this video if you did please leave a like down below also check out my patreon page subscribe to the channel for more videos like this and that's it I'm gonna see you in the next video [Music]
Info
Channel: pinkpocketTV
Views: 45,636
Rating: undefined out of 5
Keywords: ue5, unreal engine 5, ue4, unreal engine, unreal, displacement, ue5 displacement, ue5 displacement material, ue5 displacement landscape, ue5 tessellation, ue5 tessellation replacement, ue5 tessellation material, ue5 realistic tutorial, ue5 realistic material, unreal engine 5 tutorial, unreal engine 5 tutorial for beginners, ue5 tutorial, ue5 realistic environment, geometry scripting ue5, geometry script unreal, geometry script, displacement map ue5, ue5 displacement nanite
Id: 5lofKBy20dM
Channel Id: undefined
Length: 11min 27sec (687 seconds)
Published: Thu Aug 18 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.