Friday 28 February 2020

Week 8 - Material ID Experimentation

I spent a couple of days trying to figure out how to solve the problem with the material IDs, since Houdini doesn't keep the Material IDs in a way, that Unreal can use them (This might be a problem specific to our workflow, 'obj' files get imported with Materials instead of Principled Shaders).

1 - Automating the process
Since we are currently working with about 50 Modular Kit pieces and 20 Material IDs it would be very tedious to manually set up the Materials. So I did a bit of testing.
All the pieces come with an attribute called 'shop_materialpath', which I can use to get the faces with different IDs.

Material ID List
Unfortunately I could not find out how to add material inputs for the HDA, or if that is even possible, so for now we use String Parameters.
I also couldn't figure out how to edit the parameters via Python, since the geometry of the nodes is read only and the python node doesn't own the geometry, because it is not connected to the geometry nodes.
However I can use Python to create nodes, so I created an Attribute Wrangle node in each Modular Kit Node, containing the necessary logic to assign the 'unreal_material' attribute + values.

I added Parameters for each Material ID, which get referenced by the attribute. This time I added the Parameters manually, but I could have automated this in a similar way with how I did the .json file evaluation. This would make it more flexible for using different kits, however due to time constraints I chose to do it manually for now.

I also locked the geometry files, so the HDA has no file dependencies.

2 - Unreal
So, to keep it short: It works.

Material IDs in Unreal




Now that I got this working I will move on to LODs and hopefully soon more Shader and Engine work.

No comments:

Post a Comment