UE4.27 Runtime USD Import

Hello
I tried to use USD Stage Actor to import an USD file at runtime.
I used “Set Root Layer” node and it worked on PIE and Stand Alone but it did not work with packaged project.
But when I used that actor with “Spawn Actor from Class” it spawns and again, it does not work.

Is there any suggestion for it ?

1 Like

When you try to load usd in runtime with log enabled, there will be a error log :

*LogUsd: Error: The USD SDK is disabled because the executable is not forcing the ansi C allocator (you need to set ‘FORCE_ANSI_ALLOCATOR=1’ as a global definition on your project .Target.cs file). Read the comments at the end of UnrealUSDWrapper.Build.cs for more details.

Accordding to the error log, I add

BuildEnvironment =
TargetBuildEnvironment.Unique;
GlobalDefinitions.Add(“FORCE_ANSI_ALLOCATOR=1”);

Then, you should download your unreal engine from github.com and compile it by your own if you installed 4.27 from epic launcher, otherwise, you will meet another package error.

I gave up in this step because I decieded to switch to DatasmithRuntime to import scene in runtime for vray materials support.

Hope that helps.

1 Like

I helps a lot ! Thank you very much. I tried and got same errors. I wont try to compile engine because there are additional mechanics which I need to write. But I will try in the future.

I tried to use Datasmith Runtime but for CAD aspect, part names and hierarchy come broken. So I use GLTF Runtime.

I used your hints and right now I can successfully import USD files. Thank you !

Glad to hear that, have a good day friend.

Hey, Is it possible to import USD file in Packaged project If Yes can you tell me the steps to do that ???

Purpose :- I want to load all the assets in my game in runtime like i have a .CSV file that have all the data about location and rotation about the actor and the actor is in .USD format so I just want to read that .csv file and pick USD file From that location…

Thanks In Advance

Yes, it’s possible but you need to use source code version of Unreal Engine. Not client one.
After that just follow this steps.

Because client version of Unreal doesn’t support target.cs edits.

Has this been resolved in 5.0/5.1 using a launcher build to package? Would really like to be able to package using a launcher build but running into similar issues.

I haven’t tried it yet and won’t try it near future. But you can try it. Just try to import something to a template and package it. If there will be an error after target.cs edit, we can say you need source code.

Hello, Were you successfully able to import usd, usda, usdc file at runtime, if yes kindly help me out for the same…

Thanks in advance…

Yes. just follow this workflow. You need source code version of Unreal.

Thanks for helping

Yes I was able to import USD at run time in standalone mode…
But I wanted to import multiple USD file for multiple locations. But it only loads last USD file like if I have 3 root location than it only imports the last one…

Delay tried…

Kindly help

Because you (probably) try to import multiple USD with single container.

Use two actor classes.
1- BP_USD (example name) which holds USD root.
2- Another BP which has your loop to trigger import sequence.

For this:
First, put your loop actot to the scene and spawn your USD container actors from its loop actor’s inside. You have to have equal numbered container actors for each USD file.

Second, set container actors’ world space locations with your list. Do it before importing. Because after you import, moving an actor which contains static meshes will be hard. (I consider you have at least hundreds of components)

Finaly, set each container’s USD root with your path.

// Just be sure about your USDs’ main center. When you put all of them in a group in 3Ds Max or Blender, that group has to be at 0,0,0. This is your main / assembly center. If not, second step just offsets your meshes.

// Don’t use “for each loop” or “delay”. Because they don’t know when your import finish or not. You have to create a custom loop and use .json as list. Json object count will be your loop bound.

And,
create a delegate on your actor which contains loop.
create an int32 variable as “Index_USD”

After you import something, your USD container should trigger that delegate to start new import and increment Index_USD by one. So, each of them will be imported with correct order.

Yes I create to Actor class.

Kindly have a look at these…


I’ll Consider your suggestion you said and try it again.

You got the idea. Just don’t use for each loop wirh delay and do as what I say about loops.

Cool I am working on it… Thanks Man :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.