Hi everyone,
I am generating Static Meshes via code and I am running into two issues I cannot quite explain. I am attaching a video in the post to show both cases and the meshes I am referring to.
Context
- These meshes are created at runtime / via code, not imported the usual way (probably it doesn’t mind)
- The assets have multiple autogenerated LODs.
- I am testing with a car: body, wheels, etc.
1) Wheel LOD material swap
I have two very similar wheels. One of them works perfectly in all LODs. The other one looks correct in the higher LODs, but in the last LOD the materials get swapped: the tire material and the rim material are exchanged.
So:
- LOD0, LOD1: looks correct
- Last LOD: tire uses rim material and rim uses tire material
Both wheels are generated in the same way in code, so I am trying to understand what in the generated mesh or in the LOD setup could cause that material index mismatch only in the lowest LOD.
Questions:
- Is there anything specific I should be doing when building LOD sections/material slots in code to guarantee the material order stays consistent across LODs?
- Could this happen if the last LOD has a different number/order of sections than the higher LODs?
- Is there an example or recommended pattern for creating multi-LOD static meshes entirely from code so the material array stays aligned?
2) Car body with Nanite looks permanently low-poly
On the car body the LODs look fine if I do not enable Nanite.
However, if I enable Nanite on the generated mesh, it looks like it is always in a very low-poly state, as if it was picking an over-simplified version. Visually it is much worse than the non-Nanite version.
So:
- Non-Nanite: LODs look OK
- Nanite enabled: the mesh looks overly simplified all the time
Questions:
- Are there extra steps required when creating a static mesh from code so that Nanite data is built correctly?
- Is Nanite taking the lowest LOD as the source in this case?
- Is there a way (from C++/code) to force a proper Nanite build or to specify which LOD Nanite should use as the source?
- Any known limitations when the mesh is not imported through the usual pipeline?
Additional info I can provide
- The generated assets
- The video I mentioned (already attached)
Thanks in advance!