Steffen S

audim12

About Me

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Solaris to Unreal Engine - Material Assignment April 27, 2020, 12:33 a.m.

Hi,

I'm trying the Houdini Solaris to UE4 USD workflow and it works pretty well so far.
Models and textures are showing and everything is in the right place. Very promising. Even point clouds are working.
I would like to apply existing unreal materials to specific meshes when opening or reloading the stage.
Houdini Digital Assets can do this with the unreal_material parameter where you assign the reference path of the material.

Looking through the source code of UnrealUSDWrapper there might be already a function in there:

// load each material at the material path;
UsdPrim MaterialPrim = Stage->Load(Path);

if(MaterialPrim)
{
// Default to using the prim path name as the path for this material in Unreal
FString MaterialName = ANSI_TO_TCHAR( MaterialPrim.GetName().GetString().c_str() ) ;

std::string UsdMaterialName;

// See if the material has an “unrealAssetPath” attribute. This should be the full name of the material
static const TfToken AssetPathToken = TfToken(UnrealIdentifiers::AssetPath);
UsdAttribute UnrealAssetPathAttr = MaterialPrim.GetAttribute(AssetPathToken);
if (UnrealAssetPathAttr && UnrealAssetPathAttr.HasValue())
{
UnrealAssetPathAttr.Get(&UsdMaterialName);


}

MaterialNames.Add( MoveTemp( MaterialName ) );
}

What kind of attribute and where do I need to create in Houdini Solaris to make this work in Unreal's USD Stage, if possible?

Thank you!

Steffen