Would I be able to generate nanite meshes at runtime?
Hey there @bigMojitos! I don’t believe there is a native way to generate nanite meshes at runtime, it must be enabled and built before runtime. I can’t speak for the complexity of writing a generator for it from source, but I do know that if possible it would be a massive undertaking from the limited look I took into it.
So if that’s the case, how many procedurally created nanite meshes is it feasible generate at build without severely impacting your games performance and loading time? Or I guess an easier question to answer would be; does the computational cost of generating nanite meshes at build have a noticeable difference in comparison to the generating of regular, non-nanite meshes at build? And if it does how noticeable would you say that difference is?
For most instances, nanite meshes are going to be far cheaper in almost every situation. Since the math is all done GPU side you can get a little wild. There’s no hard numbers on how many, it’s more on how detailed your meshes are. If you’d like a good benchmark, I’ve linked a good video at the end of this post.
Nanite generally HEAVILY reduces the time it takes to render and cuts draw calls down to just a few. Nanite’s math is all run GPU side so the only CPU overhead are the materials calculating iirc. In internal tests a scene that took 16ms to load with normal high poly meshes took 4.5 for Nanite. That internal test scene went on to be Valley of the Ancient.
The only time you will generally get similar performance is by sticking with the older workflows of low poly, high normal/displacement, combined with instanced meshes and even then you’ll still need.
Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.
Perfect explanation thanks man!