Unreal Engine 5.2 - Displacement & Nanite Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to go over a brand new feature in unreal 5.2 we're going to take a look at how you can utilize displacement with a nanite this is shown very briefly in the unreal feature showcase but we're going to take a look at this in more detail it's a feature I'm really happy with because it does save you a lot of time it allows you to easily add details to our meshes using displacement efficiently and directly in unreal so if we take a look at this patch of wooden planks and unreal that I have here it's really just a flat plane that I took and then you use displacement to add detail to it directly and unreal and this saves us quite a few steps of having to go to another software and do that if I zoom in really close you could see that not only are these planks detailed with a texture map and a normal map but the geometry of some of these bolts or screws and things are actually bumping out of the surface and we get depth an actual shape being kind of modeled in here from our displacement so if I were to quickly just jump on over and look at this in wireframe view you can see how detailed the mesh is you can see that knot or that dip in the wood here actually being kind of detailed in with geometry so this is really cool being able to do this directly and unreal and it's not just storing it as kind of any type of geometry that just sits here it's storing it as nanite geometry so that's unreal's virtualized geometry system where it stores polygons in a way it restores individual triangles in a way where they're clustered with a bit of a hierarchy so that can be swapped out and swapped in on the Fly depending on how close or how far away you get from the mesh so I have my textures herringbone diffuse displacement normal very simple and a material that I've applied those textures too and then I applied that material to this kind of static mesh 2 meter patch which I'm just going to throw in here and put a little bit above the ground and very simple geometry nothing on that mesh is those two triangles extremely simple and if I open up that static mesh and take a look at our static mesh editor you'll see I have nanite support on you might have that off by default so if I turn that off then we won't have a bunch of settings here but we're going to go through these settings and if you don't have nanite on you're just going to see uh triangles and vertices count up here and that's that's really it and if you turn on nanite you're gonna see so I check that on apply now I see that we have not only fallback triangles and fallback vertices but nanite triangles and nanite vertices and this is important because if you're on a device that doesn't support nanite you can't use nanite so it's going to fall back to its original mesh so it's important to make sure that your fallback triangles or your mesh for falling back from an at night exists otherwise it'll become super heavy on devices that don't support nanite now if we want to make this have displacement and have the mesh turn into something more detailed than just these flat two triangles we have to enable our nanite support and we're going to go through a bunch of these settings here so the very first one below that is preserve area sometimes when making things a nanite mesh they have a lot find small details when you move far away and it simplifies or swaps out those polygons or triangles sometimes it loses a bit of volume or shaping turning on that preserved area kind of helps retain that a little bit so you could use that in some cases if it helps make your mesh look better from far away now next we have position precision and normal position Precision this is the Precision of the vertex positions and normal normals and vertex normals you can leave the default I probably wouldn't really ever change it unless you need really high quality Precision on your displacement then maybe you can set these to lower values you could specify Precision of like 1 16 of a centimeter or even lower but generally auto works fine for that and you don't really have to change it and same goes for the normal precision and then next we have the minimum residency this is how much memory or how much space this mesh is going to take up in the memory at all time so normally with nanite it will swap out details of your mesh from your hard drive ideally a solid state hard drive a hard drive with a quick read and write speed it'll swap out details in and out of your disk into your graphic card and into the game very quickly as you get closer to your geometry or further away but this is how much of this geometry or how much space of this geometry retains in your graphics memory at all times and minimal or the default here is set to minimal that's usually what you want to leave it at I don't really ever change this you only really need to change it or increase it if you notice some of your nanite meshes are popping out or popping in or having weird popping issues then sometimes opping this can help resolve that issue next we have our keep triangle percentage so the way that you can think of this is almost like a decimation control if your mesh imported or generated is super heavy and dense you can reduce the slider to decimate it to a lower amount to make it more efficient for disk space and for nanite now we also have the trim relative air so trim relative air will be important for generating uh a mesh from displacement so when we use our displacement map on here we'll have to lower that amount to generate enough polygons to add details so the trim relative error is kind of like a Precision setting higher values are less detailed but more memory efficient lower values are more detailed meshes that generates but heavier polygon wise therefore less memory efficient and then finally we have our fallback triangle percent and our fallback relative error and the fallback triangle percent is pretty much going to be a control determining how dense the fallback mesh is if nanite is not supported and then the fallback relative air is what level or what kind of discrepancy of silhouette or sizing relative to the mesh is okay for the fallback mesh so essentially if you set this fallback error to a larger value that means it's more flexible and how much the silhouette can change and it will keep reducing the mesh until that threshold is reached whereas if it's really low the mesh silhouette or the mesh shaping can't change at all so it's not going to be able to reduce it at all and your polygon fallback mesh will be the same as your nanite mesh and you don't want that at all I'll go over kind of an example of why you don't want that so let's take a look at how we can apply our displacement map to this mesh and generate the the displaced nanite mesh so what I'm going to do now is put in that displacement app so I'm going to go here add a displacement map open it up we have to drop in our texture so I'm just going to go here and pop in our displace displacement map for a herringbone texture open this back up you have to define a magnitude or how much it needs to push out I'm just going to put the five that's probably pretty extreme but let's give it a try now before I click apply very important that we set our trim relative error if I leave this at one I click apply the mesh pushes up but no details get added it's exactly the same as it originally was no polygons uh get added if I look at the wire frame and it counts up here for nanite triangles the vertices stay the same as the fallback so we have to lower this amount to generate more polygons in detail point one is going to be quite a bit so I'm going to do that and I'll click apply now we'll see that it generates 11 000 triangles for nanite and if I look at the wireframe there we go it took that herringbone displacement and pretty much made uh the vertices offset and tessellate the mesh in an efficient way to add those details so really cool but the problem up here is even though this may seem okay there's a big issue at this your fallback triangles are 11 000 vertices your nanite triangles vertices are like seven thousand right now my fallback mesh is the same as anime mesh pretty much and that's not very good that means if nanite's not supported it falls back to a super heavy mesh and the performance just goes terrible so we don't want that we need to make sure our fallback triangles are that original flat plane with barely any detail or something at least quite a bit lower than what we have here for our nanite displaced mesh so what we're going to do here is currently our fallback triangles are so high because if you look here my fallback relative air is zero it doesn't allow for any discrepancy in the silhouette and my fallback triangle percent is 100 of all triangles so full quality so that's really bad we need to change that usually what I'll do is rely on the Fall by fall back relative air so I set this to something like 0.5 and then apply let's watch what our fallback vertices go to they go to 400 polygons 400 vertices 600 Triangles around there for our fallback so now it's much more simplified fallback mesh now why am I seeing all these artifacts pop up this is because now that our fallback mesh is a lower amount of polygons what we're seeing here is Shadows from our proxy or from that fallback mesh being casted on our nanite mesh and this is because right now in this project I have Ray tracing enabled and if I go here to Ray tracing currently this mesh says supports Ray tracing but the problem is nanite does not support Ray traced Shadows if you're using nanite ideally you want to use virtualized Shadow Maps but you're not going to have proper Shadows on that night meshes from Ray tracing it's just not supported that doesn't mean you can't use Ray tracing and nanite it just means that nanite will not get Shadows from raytraced lights so I want to turn off support Ray tracing because nanite meshes shouldn't um they don't have support for Ray tracing so you should turn that off and then that will fix that issue you won't see your shadows from your proxy or your fallback mesh on your nanite mesh so I turn off support Ray tracing that fixes that issue but we still have a little bit of a problem here my fallback triangles is 600 fallback vertices is 400 that's still a bit high so if you really want to reduce it to the lowest amount like our original mesh I'll set the fallback triangle percent to zero I'll set the fallback relative error to one maybe and click apply and now you can see fallback triangles are 64 fallback vertices or 51 and you can play around that number see kind of how that changes it changes it slightly might go super high can reduce it a little bit more but that's that's probably okay so now that we have all our displacements set up done we can just save or close this and we see our displaced Geo in our viewport if we go to the wireframe and zoom out and zoom in you can see it optimizing and reducing or becoming more detailed as we get closer so much better than traditional displacement much more efficient and finally if you have any directional lights or things just make sure that Ray tracing Shadows is set to disabled if you want to get Shadows on your mesh so this is pretty much the displaced herringbone brick texture and pattern that I have here so not too bad and if your meshes are tileable textures or patches like this you might get lucky and you might be able to also tile the displacement like this and this is pretty cool because now we just have like a a seamless modular kind of herringbone brick that I could just copy and paste and place throughout my leveler scene so that's really it for displacement with nanite with uh unreal but hopefully it gives you a kind of rough idea on how to start with that and start adding some detail to your meshes and making sure that there's a sufficient fallback mesh if nanite is not supported if you learned something new or found this video helpful make sure to like subscribe press the Bell button for future notifications of future videos and check out the patreon Down Below in the description which all the patreon members will get access to this PDF that goes over kind of everything covered in this video today in a bit more detail with some extra bits of information as well so that's available for download for the patreon members and don't forget to comment down below and also let me know what other content you'd like to see
Info
Channel: renderBucket
Views: 26,949
Rating: undefined out of 5
Keywords: Unreal 5.2, Unreal New Features, Unreal 5.2 Showcase, Displacement Maps, Game Development, Unreal Engine, Unreal Engine 5, Unreal Engine Tutorial, Nanite Tutorial, Displacement In Unreal, Unreal Displacement Tutorial, Nanite Tips, Nanite Fallback, How Does Nanite Work, Unreal Optimization, New Features In Unreal, How To Displacement, UE Displacement, Displacement In UE, Nanite With Raytraced Shadows, Virtual Shadow Maps, Game Development Blog, Next Gen Games, UE Tips
Id: 6x3bXWd_QHY
Channel Id: undefined
Length: 14min 22sec (862 seconds)
Published: Fri Apr 28 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.