We’re trying to export UE-authored meshes into USD and load them in our application at runtime. To test the round tripping I’m exporting a mesh from Project 1 and importing it into an empty Project 2, but no matter what USD export settings I choose (USD/a/c/baking/payload) it won’t import correctly into Project 2. Has anyone completed this round trip successfully? The mesh comes in but materials are all missing, triggers a lot of warnings in output log like:
LogUsd: Warning: UE material '/Game/_Workspaces/_Sample/GameController/Materials/Instances/MI_Plastic_Black_Spec-10_Rough_3.MI_Plastic_Black_Spec-10_Rough_3' for prim '/SM_Glossi_Controller_v3' could not be loaded or was not found.
LogUsd: Warning: TF_DIAGNOSTIC_WARNING_TYPE: In </SM_Controller_v3>: Cycle detected:
@c:/Users/x/Desktop/SM_Controller_v3.usdc@,@anon:00000229571E9E90:SM_Controller_v3-session.usda@</SM_Glossi_Controller_v3>
CANNOT get payload from:
@c:/Users/x/Desktop/SM_Controller_v3.usdc@,@anon:00000229571E9E90:SM_Controller_v3-session.usda@</SM_Controller_v3>
(computing expanded prim index for </SM_Glossi_Controller_v3> on stage @c:/Users/x/Desktop/SM_Controller_v3.usdc@ <0000022A2D25EFB0>)
Hello
in USD you can have several material definition for a material and UE allows you to switch between them. In USD stage you can see them in Options > Render context > Universal/Unreal/MaterialX/MDL. In USD import you have it in the USD Import Options dialog > USD Options > Render Context to Import.
Universal: is reading the default material definition in the USD
Unreal: is the default option, and is reading either an Unreal Material if it is specified or else will default to the same than universal.
MaterialX: if your material is using a MaterialX definition (as external file and not embedded in USD)
MDL: if your material is using an MDL definition.
Unreal material is basically reference to a path to an unreal asset in your project. When you export USD from UE you will always get the Unreal Material definition exported.
This is what you see in your case: you exported from UE so the Unreal material definition is present in the USD + UE default render context is “Unreal” so UE reads the USD and then tries to load the unreal material path that is empty because you did not copy your unreal material in the new project.
LogUsd: Warning: UE material '/Game/_Workspaces/_Sample/GameController/Materials/Instances/MI_Plastic_Black_Spec-10_Rough_3.MI_Plastic_Black_Spec-10_Rough_3' for prim '/SM_Glossi_Controller_v3' could not be loaded or was not found.
While Unreal materials reference are always exported, to get an Universal material in USD you need to tick the “Bake Material” option in the USD export.
Your options:
Copy the Unreal material in the new project (that might not be what you want, if you want to copy assets between project you would use UE migrate tool and not USD)
Else switch your render context to Universal and if material is all white make sure you ticked “Bake Materials” when you exported your USD. This can be a lossy process since you bake the UE material into a USD material definition.
Baking doesn’t work well for us, we tried and got pretty bad results. We’re using the Epic Automotive Material pack for the most part to take advantage of the projected tileable materials.
We’re staying within Unreal so no need for any other compatibility.
Long story short, sounds like there’s no way to export a fully self contained USD file that contains the model, materials and textures that are loadable in a runtime app? We’d have to copy the materials and textures into the content browser before packaging so the USD can find them?
Baking is the solution if you want your USD to be self contained (to use in another USD viewer or in an unreal project that does not have the material assets).
You could list what are the “pretty bad results” so we can see if it is something we could improve.
Also be aware that runtime import of material, even good material, might not hold good results as runtime application cannot rebuild material on import.
I cannot test ATM but I would say that in your case having your materials cooked in the application will guarantee you have good looking materials at runtime.
If all your models use the same material library, Automotive Material, then it is one of the only time where it is valuable to cook and bundle library and have your USD file use those premade materials.
So first to clarify as I did not express myself properly:
when you bake material you do not have a self contained file that would be generating a USDZ file where everything is inside.
Bake material will create material and texture files so they are not directly embedded into the USD. But they come with the USD contrary to the Unreal exported materials that are just a ref in the USD file and the assets are expected to be somewhere in the project folder.
Regarding the bad quality of the bake material, that can be some bugs or limitations of the baking process. We need to do more tests on our side.
Keep in mind again that baking process will always be some kind of lossy process.