copying/manipulating FBX shop_materialpath attributes

   3146   2   0
User Avatar
Member
9 posts
Joined: Sept. 2018
Offline
I am using an HDA and Houdini Engine for Unity to load .FBX files and manipulate their geometry and output the results to a new .FBX file using a ROP node. It works fine, but while working in Unity it would be useful to visualize the objects with their Unity materials on them for reference.

If I use either the UnityMaterial or AttributeWrangle node and create the appropriate explicit path to the unity material in a string placed in the a unity_material primitive attribute, the objects appear exactly as in game - perfect.

Since my FBX @shop_materialpath attributes have names that are directly related to the unity materials, it would ideal if I could just derive the @unity_material attributes from the @shop_materialpath attributes.

Example:
The shop_materialpath attribute “urbMatBldn_civilian_roof01” from the FBX would allow me create the unity_material attribute Assets/Environment/Models/Structures/Urban/Materials/urbMatBldn_civilian_roof01.mat by just pasting the path on the beginning and .mat on the end of that string.

I can do string compares with the @shop_materialpath atttribute to create groups, but if I try to use VEX to copy this attribute like a string and manipulate it, Houdini isn't happy.

I can do those string compares to create groups and set those groups to Unity materials, but this requires a lot of tests for all the different materials. And if my artists come up with a new material, I need to update my HDA.

So I'm wondering how could I turn the shop_materialpath attribute into a string I could wrangle into a happy Unity material? Or if that is the wrong approach, how can I turn the shop_materialpath references into appropriately modified references to Unity materials?
User Avatar
Member
571 posts
Joined: May 2017
Offline
Not sure if I am understanding you clearly. Is the Unity material already created, or do you want it created at a path you specify, which is based on the shop material name?
User Avatar
Member
9 posts
Joined: Sept. 2018
Offline
Thanks for the follow-up seelan.

My only problem turned out to be that I didn't realize that I needed to specify a datatype for the already existing parameter @shop_materialpath. I needed to use a leading s before the @ to specify I wanted to address it as a string. This casting is not necessary when using the parameter to create groups.

So the VEX statement s@unity_material=“Unity/Material/Path/”+@shop_materialpath+“.mat” wouldn't work. But s@unity_material=“Unity/Material/Path/”+s@shop_materialpath+“.mat” does.
  • Quick Links