Possible to enable/disable Nanite at runtime or swap a Nanite mesh with fallbacking to a standard Static Mesh without making duplicate files?

I need to use Nanite but also need the given Nanite mesh Material to be a Blend Mode of possibly Masked (depending on user’s input)

According to Nanite’s documentation Masked blend mode is not supported. So I am thinking of swapping a Nanite mesh for a standard static mesh at runtime when the user’s needs it. Is this possible without having to copy each Nanite mesh and then disable Nanite in the content browser for that copy?

Is there a way to fallback to a standard static mesh at runtime? Apparently enabling/disabling Nanite at runtime is not possible so looking for a work around.

A similar solution such as what is explained for the vehicles in the Matrix Awakens demo is what comes to mind. But open to alternatives. It seems in the solution explained they used two seperate meshs. I’m hoping to avoid that.

There should be a bDisallowNanite flag (which can be set a runtime) on StaticMeshComponent for the renderer to fallback to the nanite proxy mesh if r.Nanite.ProxyRenderMode is set to 0 which should be the default.

Did you watch the State of Unreal talks held at the GDC recently? Epic explained how they updated Fortnite assets to work with Nanite. Trees and grass for example was updated so that individual leaves were modelled and the material didn’t need to be masked anymore. Of course if the mask comes from user input that makes this more complicated. If you’re interested in the details you can read more here: Bringing Nanite to Fortnite Battle Royale in Chapter 4 - Unreal Engine

3 Likes

Thank you so much. I’ll look into the suggestions you made and resources you pointed to. I haven’t finished all of the GDC talks yet. So good excuse to.

Seems in 5.1 you can Dissallow and Allow Nanite on Static Meshes. That plus all the new enhancments to Nanite helps solve my problems. The fallback nanite mesh doesn’t look great though. Worse than the orginal Static Mesh (which in my prohject do not have that high of a polycount).

do you have the fallback relative error set to 0 (default is 1)? If it’s not 0 then it will always do some kind of “optimisation” of the mesh for non Nanite. 0 should make them 1:1. This can affect light baking with some meshes where the fallback default can get oversimplified to the point it introduces artifacts in shadowing.

1 Like

I still have this issue, if the fallback relative error in SM details is set to 1, then the fallback mesh will successfully generated and got some ‘detail removed’ as the document is mentioned. AFAIK for perhaps all the situations that not supporting nanite, nanite mesh will use the fallback mesh for rendering, even if bDisallowNanite is set as true in SMC’s details it shows fallback mesh as well. What i’m looking for is if we can use back to the original mesh at runtime when nanite is disabled in any situations(not supported or autonomy), May have a better solution than copied mesh.

Well i think i may had some misunderstand about nanite documentation at fall back mesh segment before and after several tests i found that if you want to dynamic switch back original LODs in nanite enabled project at runtime, there might be at least one way.
According to the documentation, for a nanite enabled static mesh, we can set Fallback Triangle Percent to 0 and set Minimum LOD to 1 then the engine will use those custom LODs from LOD 1 to LOD n you’ve set. So if you want to keep LODs, just re-import LOD 0~n to LOD 1~n+1, then set bDisallowNanite=true when the LODs are required.
By the way, it will scale up the resources with no doubt.