Download

Nanite and multiple materials

Been playing around with UE5 this evening and I’m loving lumen and playing around with all the new options! I tried enabling nanite on this tree I’m working on:

without Nanite: (151k tris)

Nanite settings:

result: (22k tris proxy)

As you can see all of the materials are removed from the mesh. If I try this again on another simpler rock mesh with just one material it does work fine.

Does this mean Nanite is locked to one material per mesh? Or can’t it handle anything that has alpha (leaf meshes in this case) attached?

Either way, I’d almost never make a tree with just one material (using tiling materials for the trunk, leafs, etc). Is there a way around this, or do you have to always export with one drawcall from speedtree?

Keep up the great work Epic ppl, can’t wait to dive more into this!

Thanks for having a look!

2 Likes

Nanite only works with opaque materials. Not masked or translucent

4 Likes

Any blend mode besides opaque is unsupported in nanite according to the docs.

It’s unclear if some or none of them will be supported later, or if there is a technical reason why nanite can’t support them at all(ever). Hopefully it’s just the latter, with things like masked at least.

Thanks guys! I didn’t see any docs up yet when I was testing this, thanks for the reply :slight_smile:
I guess I’ll try very low poly leafs and exporting from speedtree, see what happens :stuck_out_tongue: (10 mil tri tree I’m guessing).

Nanite does work on the geometry of the leaf planes but I’m guessing it would totally destroy the UV’s for the mask so it’s not used on anything masked/translucent. Thanks again! I’ll post an update when I get a proper tree in.

Nanite does not support vegetation, it should not surprise you that you run into problems with vegetation.

Managed to get Nanite working with vegetation,;


I really wanted this to work because of the moss I’ll be painting on trees, rocks or even part of some ruins. Basically, the moss is a mesh now with double sided geometry because Nanite does not support double sided materials. The tree is around 700k tris in total but thanks to Nanite this is no problem at all.


The moss mesh before painting it on the tree in maya:

It is assembled in a blueprint / foliage actor:

Of course, I would love to properly model the leafs instead of these huge alpha cards, but Nanite does not yet support vertex animation, so I’m skipping that for now, and at least the heavier part of the tree is now supported by Nanite.

Hopefully this will help some of you out, or if you have some suggestions or comments to this workflow please comment here :slight_smile:

3 Likes

As far as I understood Nanite, everything that works against a static normal vector is not possible.

Nanite subdivides the meshes into triangle cluster. It tries to combine triangles with normals that are close to another. Nanite then gives the cluster an averaged normal.

When rendering, Nanite goes through all clusters of a mesh and makes a dotprodukt with the camera vector (and probably also bounds of the cluster with the view frustum).
This ensures that you only send geometry to the graphics card that is possible to be seen by the player from the view direction. Not sure what happes to triangles of e.g. a tree trunk that is partially visible behind another object, though.

That cluster culling alone ensures that you can send much more visible geometry to the graphics card and spare geometry that you definitely can’t see. Also you don’t realy need face culling of the graphics card anymore, as you only send relevant geometry anyway. Thus shaders should also be more performant.

That behavior though, requires static face normals. Thus you can’t use vector displacement in the shader.

Same for backfaces. Sure, they cloud add the additial querry, but the code would lose its straight forwardness and with that performance.