How To Use Displacement in Unreal Engine 5.3! (Step by step tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] the goal of this video is really just to make displacement look decent uh and I'll show you any bugs and issues that I've found along the way and hopefully how to fix them as well as go through a few different types of scenes and how I use displacement maps in my workflow in Unreal Engine so we'll go through Landscapes architecture scenes and some detail object scenes let's just jump straight in so method one is where we will select our object or geometry in the scene we're going to go to our static mesh you just double click it here this window should pop up and we're going to enable nanite support and uh what do you call it Implement import apply sorry apply the displacement map in your static mesh settings so or static mesh editor I guess you'd call it so I'll just quickly show you an example of how I would do this from Cinema so I just have this plane here called displacement wall I haven't even baked it down actually so I just have a plane uh I've got some subdivisions in it but actually it doesn't really matter because we're going to apply nanite to it anyway but I have some subdivisions in it then I'm just going to do a file export selected objects as and fbx default settings should be fine now I'm just going to do an import of the file that we just exported in the dialog box you could also just say um build nanite in the import settings everything else I'm pretty sure is the same so then you just hit import so now this is our fbx that we just imported I'm going to hide the original guy drag this dude into the viewport and zero out the coordinates and it'll snap into the right place because all the geometry I have in this scene is based off the same Cinema 4D scene coordinates that I just had or the world coordinates now I'm pretty sure the material I used yeah smooth layer Rock so I'm just going to drag this guy onto the wall and you'll see there's no displacement right completely 2D flat plane all the shading that we're getting is from the normal map that's built in now what we want to do is first you're not going to have this displacement texture you'll probably just have these four objects so what we want to do is you want to grab your o DP this is a packed texture uh asset that quicka makes and I'm pretty sure sure o Rd is occlusion for ambient occlusion then roughness and then displacement so this is ambient occlusion green channel is roughness and the blue channel is displacement so we just care about the displacement channel so what we can do if I oops if I close this guy what I like to do is I'll just select the pack texture duplicate it by pressing contrl D and then at the end and I'll just add displacement hit enter give it a second and now just double click and open it up so remember again we just want the blue Channel which is the displacement and to isolate that first thing we want to do is change from from texture group to no mmaps then scroll down the details panel some more and find source color settings in the source color settings we want the encoding override to be linear and then the color SP face from none to custom now it'll go black we want to tell the engine hey we want all the values in the blue Channel which is displacement and then also all the values in the white Channel which I want to say is the alpha but I'm not 100% sure but once you do that now we have extracted the displacement map and just to check and make sure we have that I'm going to open up the original just isolate the blue and when I swap between the two they look pretty similar there is some more banding happening in the original and I'm not sure if I'm losing data by doing this method so if anyone else out there does have a better technique in Unreal Engine 5.3 please let me know now we have our displacement map we can go back into our static mesh settings so in your static mesh settings you'll see on the right right here in the details panel nanite enable nanite support should already be checked because we did that on the fbx import but if you haven't just check it and then hit apply it's not a big deal the main value yours your trim relative error will probably be on Zero by default this is kind of the main value that you'd be playing around with as well as some stuff here will set in the displacement map um let's actually first set the displacement map so if I hit the plus icon here in add element and then in texture I will bring in let me make this a bit smaller I want to say it was this guy that we just saved out cool so now we have our displacement map assigned and then we hit apply nothing will happen yet because we have not told it a strength value and we have not given it a resolution amount so at the moment this sort of acts as a mesh density or mesh resolution controller or slider of you know how much detail you want from your displacement map uh render bucket and Mr 3D Dev I think I want to say but definitely render bucket has a great video going over these nanite settings in the mesh editor as well as the displacement map so if you want some more detail go and check his video out um I would say a good place to just start at is maybe 0.1 it's quite safe you're not going to crash your engine make sure you do a save all uh here before doing all this because it has crashed on me a few times when I try to push it so yeah like a 0.1 would be good and then when I first started out what I did I just went yeah like a magnitude of five should work and then I hit apply and then I realized like nothing is happening at all I think at least maybe I can see some super slight movement when I would go in the wall like this and I realized I actually need to bump up the strength a lot more so from five I went to 50 and then I hit apply give it a sec and now you'll see we actually if I go to the backside you'll see we're actually getting displaced geometry now in the scene and if I yeah if I go to this profile view here you can see we're actually following the rock Contours and and then if I go to alt 2 which is wireframe you can see nanite working doing its magic and then if I go to nanite visualization triangles you can see nanite working right here so if I go back to my mesh settings here or static mesh editor I found going down to 0.05 worked quite well and then actually I wanted a bit more intensity on the rock formations so I did I think I did 0.05 and then 100 and then hit apply now this could take your machine a while to calculate this so just let it finish if you've actually gone a bit lower on the trim relative error than 05 and it's really you know it's gone over 10 minutes and it still hasn't finished I would probably probably just go to task manager and end task on unreal reopen it up and then try Z .0 no try 0.1 and then just go down by single decimals if you can so that's just finished up here and now you can see we are actually getting some proper displacement so if I go to this viewport let me go to cam 3 or maybe cam 2 and maybe I'll move this guy around and you can see the Shadows on the left here are catching quite they're actually being displaced by the rock formations and if I also turn on my cam 2 light settings which are a bit more top down you'll see the displacement at work now one thing to point out that I probably should have mentioned earlier you might have support Ray tracing on by default this can mess up your mesh as you can see here gets all these weird Shadow artifacts everything goes wrong I would suggest disabling it and then that fixes all the shadows and with large objects like this I seem to have had no issues with it so definitely do that if you know you have a camera shot that's sort of like this flat on you don't have any crazy Shadows being casted from this rocky object then you should be able to do it with no problem so you disable that support Ray tracing and actually if I hide this I found a nice location yeah so this wall I kind of just moved it around a bit until I found like a nice sort of rock formation in the displacement map that I liked and then I can now go to my directional light here and sort of play around with it and you'll see if I change I think the pitch of it it's called if I go a bit more top down you can really start to see that displacement mat doing work where the front is really being lit up quite nicely and is actually being properly displaced you'll also notice as I get close you can kind of see the stretching and the displacement happening so definitely be aware of that like super closeup detail shots you probably want to reduce the magnitude that I use so for this one I was able to go down to 0.03 for my final bake and then I went 100 in the magnitude I think for this it looks quite good because of the scale of the wall and how the camera is far away from it but if you are going up close I would suggest honestly to either use less magnitude or bake in the displacement which I will talk about a bit later in this video so stay [Music] tuned so for the second method it'll be a bit more traditional where we're going to be using a displacement map in the material editor I've decided to do this in a more detail object type of scene so maybe you have a product or a cinematic shot where you really want to capture the details of a material so if I jump in to the material here again just another quickel material oops sorry I've dragged that off the monitor I I scroll down to the parent material all I have done is dragged I think by default this blue channel from the AR AO roughness and displacement packed texture is disconnected all I've done is grabbed it gone all the way to the right and input it in the uh surface material displacement input I'm using substrate materials here but you can do the exact same with the default um default ue4 material uh editor I'm pretty sure this is actually yeah this is a conversion because it's using the old quickel parent material so you can definitely do this with the default material editor this is all I've done now it won't work straight away so what you need to do you need to navigate to your project folder where you've saved this in your hard drive so mine's here and I've just gone to the config folder in the parent uh project folder So within the config folder you just want to find this default engine.in file also quick shout out to Mr 3D Dev I was watching his landscape displacement tutorial video and that's where I picked up these tips so just double click open up your any file in a text editor any text editor and then underneath render settings I have just added these two console variables so they launch with that so just nanite allow tessellation 1 and then nanite tessellation equals 1 once you've added those two things restart your engine and now you should have displacement working in your material if it is not what is happening is if I go back to the parent material I have the displacement input if you scroll down here you'll see displacement so by default it's on four and five so if I hit save so once you hit save and it applies you can see the default value is pretty strong but it really all depends on your displacement map so if I move around here drag this down you can see this is crazy and you're getting like some weird geometry nanite artifacts speaking of nanite by the way you definitely want to make sure that your meshes are nanite enabled actually if you just go to search for it in your content browser you can hover you can see nanite is enabled for this and then this guy here you can see I've split it up into two which I'll explain in a sec nanite is also available here by the way if you're wondering how I clicked this and then navigated to it in the content browser just select your object in the view port and then hit contrl B and then it'll select the mesh in your content browser or the asset so yeah four a magnitud of four way too strong let me turn that back down to one and then I think I had this on zero and then hit apply give that a [Music] sec okay that didn't work maybe it was still on 05 let me hit apply again uh there we go okay so yeah 1 and then .5 so that's pretty much like the material displacement map method of doing this you just really got to plug in a displacement map into displacement input in the material set your displacement magnitude in the Shader settings and then make sure you have nanite enabled on your meshes and you'll see all this amazing detail that you're going to get from this mesh here you see all the ridges you can actually see it being displaced and if I move it up you can actually really get a good idea of how displacement is working so again this is just a quickel material also quickly the reason I separated this is because sometimes when you have a displacement map you know the the mesh might displace weirdly so I like having separate control of the placement like if I want to inser it a little bit I can do that and that way you know I have control over the height of the mesh as well as the height of the displacement map itself in the material but yeah this method definitely works quite well however I still think there's a better method for detail objects so let me get that get to that now so for this next section I just wanted to give you guys a heads up on what I think could be a good workflow if you do really want some detail displacement to look good in unreal and it kind of is actually let me just show you com the comparison of applying displacement Maps so I have a mesh a plane here that has been displaced and then baked down and I have displaced it using just a simple black and white checkerboard map and then what I did was right click connect and delete and then I can now get rid of this displacer and then I export out another plane right next to it not displaced at all and then if we go back into unreal this guy on the left is the Cinema 4D displaced plane and then this guy on the right and I believe this guy here is the nanite displaced plane so let me double click and open him up yep okay so this mesh here that I have selected is being displaced with nanite as you can see the Checker pattern and then this guy here if I open him up no nanite displacement what you'll notice is one there's a few more artifacts in the nanite displaced one and you'll see the displacement happens a bit differently it's the exact same texture but the corners look a bit different and the way it it displaces is a bit different so here you you can see it's straight up and straight down and the way Cinema has done it there's like a bit of a curve because of how it calculates polygons it stretches the vertices out it doesn't extrude them out directly above and maybe there's a bit of blur in the edges I'm not sure how it calculates that but you can see the exact same map comes out different so keep that in mind and second these two guys are using the exact same materials and have the exact same UV coordinates and unwrapped UVS but when I do nanite displacement it actually stretches the UVS along the displaced uh geometry whereas here it tiles perfectly because this was all baked in so these are a few things I would keep in mind uh when choosing whether to bake or not to bake so definitely again keep that in mind also there's one more thing I also want to show you with detailed displacement maps you can see this mesh on the right if I go to nanite triangles you can see using nanite but this mesh here is using the exact same displacement map as this mesh here the only difference is this mesh on the right it's using a displacement map I put it in a displacer object like you saw here and then baked it down in Cinema 4D and imported into unreal and then obviously I enabled nanite so that it would be performant and not bog down the scene so you can see came through super nicely like really smooth I've got this glossy plastic on it and you're not really getting any crazy artifacts I would say however this mesh here I've put in this this was the displacement map I've applied it to it and I'm getting really weird results to be honest I don't know why it's coming out like this it's got some weird shading happening I've tried to disable Ray trce Shadows it still doesn't fix the problem and in the viewport it looks half actually it doesn't even look half decent to be honest with you so if I just apply a basic material to this you can see the shading is super weird with like a very detailed displacement map maybe if I try one so that crashed my PC what I'm trying to say is if you do have detailed displacement Maps like this and they play big part in your scene I personally would recommend baking in the displacement in whatever 3D modeling software you are using and then just enabling nanite when you bring it in and it'll look really good and you won't have any crazy performance issues let's move on to Landscapes so for the landscape again quite simple the same setup as the material uh displacement method uh again shout out to Mr 3D Dev for making a video on this so this was kind of a new edition I think nanite support and displacement for landscapes in 5.3 and I just downloaded these two materials off of quicko so TR dry trampled sand and Jagged Rock and the material for this really simple just like six nodes and that's it with a tiling thing for the landscape setup I just went to landscape mode created a new the default setting and then just sculpted some stuff so let me 1024 just did some of this and that's all I did and for the painting this is really cool you can actually paint on rocks and actually get the displacement that we want it's not showing up now we just got to rebuild it but I'll show you in a sec how all of this works and you can see here once I painted around and rebuilt I am now getting proper good displacement and in terms of tiling it actually looks quite decent and then the blending from The Rock to the sand also looking quite good so let me give a quick overview of the material setup and how this all works and also a little plug that I found and how to fix it so with this setup it's the exact same as the Mr 3D Dev tutorial you just get your two sets of materials that you have so these are my rock textures these are my sand textures you create a landscape layer blend create your two different layers and then you name them so I would call this one like And subscribe so I would call this one sand and rock and then you just hook up you have one for base color I had one for roughness one for normal and then one for displacement again same concept with the displacement roughness the blue channel is displacement so you would just hook up the displacement of the rock into the rock layer and then the displacement of the sand into the sand layer so that's where the uh nodes linked up and then again just H hook into the displacement input these are the base default material Shader settings so you don't need to worry about that it should work fine one issue I did have is initially if I go into the landscape editor when I went into paint when following his tutorial I was not getting these layers showing up and I don't know if it's a 5.3 thing or I don't even know what if it's a it's a substrate material thing what I had to do is well for some reason when I went into my displacement and set the preview weight to one here it all worked I don't know if it's a fluke when I turn it to zero it stops working not really sure but if something's going wrong with your landscape and you're not getting these layers try changing your preview weight to one for one of them and hopefully it should work from there with the landscape itself if I go to selection then nanite settings very simple you just want to scroll down enable nanite build data then do all your landscape material stuff do all the sculpting and painting and if it doesn't look right just hit rebuild data and then it should work fine and there's no settings for Ray tracing that you need to worry about so yeah very simple I love the material method for the landscape here using displacement I think it's great especially if you want to you know set up these little alcoves here and then just create if I create like a cinematic camera control shift p to Pilot and then you know you can sort of start blocking out your scene here and you really get some nice displacement and sand and everything going on so definitely a good method I love this update for Landscapes I'm definitely going to be playing with it more let me tell you a few final thoughts and then we can get out of here so for displacement Maps method one which was editing this static mesh settings and applying the displacement map separately there that we showed at the beginning that's good I found for large scale walls where you can really control the the relative error the mesh density things like that that's kind of in the background and vertical or you know rectilinear style geometry I think great for that detail objects I think I still prefer baking in the displacement in my 3D software the material uh displacement way is still decent but I think I'm still leaning towards baking my displacement in the 3D software and then obviously here for Landscapes as you just saw the material method definitely works amazingly well you can paint in your displacement blend a bunch of different layers together I only showed two layers but you can definitely do more and again shout out to Mr 3D de and render bucket for their videos they give great technical overviews of this if you want to learn more definitely check them out again this video was to show my workflow from an art directing and 3D art perspective in terms of how I use displacement maps in Unreal Engine hopefully you learned something and you don't have too many issues and if you did leave them in the comments below I'll try my best to help you guys out and I will catch you in the next one peace I would call this one like And subscribe
Info
Channel: ali.3d
Views: 6,104
Rating: undefined out of 5
Keywords:
Id: U_-za-hfaLI
Channel Id: undefined
Length: 27min 30sec (1650 seconds)
Published: Thu Oct 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.