Material LOD for Nanite?

I have an idea to increase performance for scenes with many Nanite meshes:
Since Nanite meshes that share the same material result in only 1 draw call, we could use Vertex Color of the high poly meshes instead of a color texture. This way, certain Nanite meshes would share the same material, only using Vertex Color.
From a close distance it’s too blurry, but what if we use a regular material with a color texture and swap to vertex color material as LOD1?
I’ve tried it, but it doesn’t work for Nanite meshes (tested in 5.3).
Is it possible to swap the material of Nanite mesh based on its screen size?

Swapping the material based on mesh screen size would be useful in general, not only for this solution.

This is already implemented in the engine, it’s called ‘texture streaming’ :slight_smile:

Texture streaming changes texture resolution based on screen size, but meshes in a scene still use individual materials (or material instances) with their respective textures.
My idea was to leverage the fact that Nanite draws all meshes in 1 draw call if they share the same material. Having only 1 universal material (assigned to all smaller/distant meshes) that uses mesh vertex color could do this.

I’m not sure if I don’t overthink it though, maybe the performance gain on something like this would not be that noticeable.

1 Like

(moved from content creation to Rendering)

Material LOD works on regular static meshes (tested on 5.3), but it doesn’t on Nanite meshes. I’m not sure if it’s a limitation of the rendering tech…?

As a workaround, we could implement this via Blueprints, checking the mesh bounds in a looped timer, comparing to camera distance, etc, and just switching the material via BP script. But it would be nice to have it working like it does for regular meshes via the LOD system.