How to Enable Nanite with USD Files

Hi, I’m trying to enable Nanite on my USD scene/file. I reduced my Nanite triangle threshold in USD Stage > Options > Nanite but it still not enabling Nanite meshes (I also did File > Reload).
I’m exporting USD from Blender 4.0.2 and I use UE 5.3.2
Am I doing something wrong or is there a bug? Any help is appreciated.

Can you give more details? From the nanite preview it seems some geometry has nanite enabled: the tree, the wooden box next to the tree, some lines on the road.

To enable nanite on your USD:

  • you can use the threshold on the stage as you have been doing,
  • you can add property on the USD file
  • you can make an editor utility widget that will activate nanite on static mesh in editor.

the white buildings seem to be out. are they part of the same USD?

Hi @UE_FlavienP , tree is from Megascans, wooden cube and plane are created inside UE5, other lineworks are FBX imports and manually enabled Nanite for those.

I think I found the solution and the culprit:

  • I deleted all my USD actors and created a new one, everything worked as expected.
  • I noticed if I change “inputs:opacity” value of any material, Nanite gets disabled (I did this for my Glass materials before checking Nanite overview and didn’t realized it). Changing the value back to its default value doesn’t fix it. Only undoing that value change enables Nanite again.
  • Oddly this even happens if I change the opacity/alpha value in Blender, export USD, then reload in UE5, Nanite disables again! This seems to be happening only with opacity (Roughness, metallic works fine).

Is this a bug?

2 side questions:

  1. What is the best/efficient way to copy/instance a USD file in UE5? I’m planning to create 10 copies of that villa.
  2. I can’t select individual objects like in this video: https://youtu.be/t4U8-rYwR0k?t=193 When I click any of the objects, whole USD file is selected. What might be the reason for that?
1 Like

I see Nanite is not working with transparent material so that it what might happened here. Not sure it is normal that it does not come back when you switch back opacity to 1. I will report that.

For instancing, I would create a new USD file that refers 10 times to that Villa.usd.

did you tick “synchronise with editor”?

1 Like

Could you elaborate more on how can I do that please? Is this method better than creating 10 actors that references the same villa.usdc?

Yes it’s ticked.
I noticed that if I create new objects without parent, they can be selected individually. Currently my whole villa is parented to an empty object in Blender. So, all mesh objects are basically “children”. Is it not possible to select child objects from USD file?
I also tried all different collapsing methods from options but it didn’t help.


One more side question:

  • How to change material from USD files?
    When I change a material, then reload the USD file, it also reloads the material back to the original one. Can I make an exception for some materials (or meshes) not to be reloaded? What is the best workflow for achieving this?
  1. In the stage actor you can pick a node and duplicate it.
    you have 3 different options for that
    Working with USD Stage Prims in Unreal Engine | Unreal Engine 5.3 Documentation
    Not a specialist but different options are about how you preserve or not the layering and overides.
    You will have independent actors in UE but they should use same static meshes and materials.

For the use case where you need to instance a lot of simple geometry, those are point instancer in USD that UE will import as Hierarchical Instance Static Meshes

If your prims instances are instanceable we do not support that yet in UE.

  1. Yes, that is what I note too. I would let people used to Blender to give tips.
    You can for sure A) remove parents to the different elements. B) Assemble the different house elements in separate USD and then make a House USD that just refers all the separate USDs elements to create a house.
    C) I also notice you can tweak that option and it allowed me to move some of the element in hierarchy individually. But that did not gave me the full hierarchy in UE world outliner, for that you will have to do A or B

  2. To change materials, not sure it is what you want to do. Are you in the context of stage actor?
    Load a usd file in a stage, then you can change material on assets and then you can save those changes back into the USD. Do File>Save in the USD stage window.
    In that case, UE adds a reference to the Unreal material from the project in the USD file. Then if you reload the USD, by default UE will use the Unreal material now referenced in the USD. You can see the original USD material if you change the “Render Context” to “Universal” Options>Render context>Universal

If you change material properties on prims, you should save back the USD stage to USD to make sure those properties are written in the USD file.

1 Like

When selecting collapse methods from USD Stage, it doesn’t work. If I do that from “Details” panel of the Actor, it works.

I have also encountered lots of bugs or inconsistencies related to materials and textures. I tried a lot of different approaches but none of them worked good, so I gave up trying USD worklow for now. I’ll continue with FBX or glTF formats for my next project.

I’ll be revisiting this topic if I see some updates related to USDs. Thank you for your help @UE_FlavienP

m0re0ver

Hello!
Could you explain more in-depth about 2nd and 3rd options?

  1. [you can add property on the USD file]
    Is it doable inside .usda and some kind of a code? Also it there way to add Preserve Area to certain or all prims (meshes)?
  2. [you can make an editor utility widget that will activate nanite on static mesh in editor]
    Where can I find more info about it?

The reason for these questions is that I have a .usda file containing many different meshes (Hierarchical Instanced Static Mesh Components) that I need to enable Nanite for, while also preserving the “Preserve Area” function to maintain good performance and quality. However, I haven’t figured out how to enable these functions in a proper way for all of them without selecting each one individually and navigating to its static mesh properties. After reloading, none of them have the “Preserve Area” setting saved. Additionally, the .usda file doesn’t have any new bindings or property overrides. What would you suggest in this case?

Hello,

  1. AFAIK You cannot save the nanite settings in a way that UE will read from the USD file.
    You can only save the property to enable nanite on the mesh.
def Mesh "SM_XXX" (
    ....
)
{
    custom token unrealNanite = "enable"
    ...
}

a) You can select all your static meshes at once, then right click, asset actions > Edit Selection in Property Matrix

Then you go to nanite settings and change what you want and it will apply for all selected static meshes.

b) Else you create an editor utility widget

You add a button and link it to some code that would look like this:

1 Like

Thank you for the detailed answer!
So, as I understand it, there’s no ability to enable and save the “Preserve Area” setting of Nanite inside USD without importing assets into the engine. I can only enable/disable Nanite property through a custom token and save it directly into the .usda file, right?

If so, then I have another question. I have a PointInstancer named “GRASS” with lots of instances inside my USD file. When I load it through the USD Stage Editor, my USD Stage Actor looks like the screenshot (lots of HISMs). When I try to import the whole scene, my instances aren’t imported, and the only way to keep them in the scene is to work directly with the USD stage actor. So, I have to manually select each one of the HISMs, move to static mesh properties for each selected HISM, and only then check the Preserve Area setting. Basically, I cannot do it via the Property Matrix or Editor Utility, am I wrong?

1 Like

Update the blueprint to work on static mesh of selected actors instead of asset in content folder

1 Like

Thanks for the reply!
I’m a newbie in blueprints and cannot understand why I got such an error on compile. Am I doing something wrong?

You need to create a local variable “MyArray” that is an array of Actor (Object Reference)

2 Likes