Houdini Engine for Unity
 All Files Pages
Materials

Unity materials can be assigned to Mesh outputs of Houdini assets in two different ways:

  • use an existing Unity material by specifying it By Attribute.
  • have the plug-in Generate a new Unity material based on the Houdini material found in the asset.

These generated or automatically assigned materials can also be overridden by manually assigning a material in Unity (see Material Overrides).


By Attribute

The special Unity to Houdini primitive attribute unity_material can be utilized to specify an existing Unity material to apply to a given primitive. When generating the Unity Mesh, the unique set of assigned primitive material attributes are collected and a submesh is created for each material. The materials are then assigned to the materials of the MeshRenderer component of the output GameObject.

The unity_material attribute should have the relative path of the asset, from the Assets/ folder as its string value (eg. Assets/Materials/Red.mat).

Primitives that do not have any materials assigned will have a default material automatically created for them.


Generate

The plug-in can attempt to generate a Unity material with similar properties as the material applied in Houdini. This is done so by creating a new Unity material with one of the shipped shaders from the HoudiniEngineUnity/Shaders/ plug-in directory, then reading parameter values on the associated SHOP or VOP nodes and assigning them on the material.

Textures will be generated by copying the associated data from channels which are connected through parameter names or tags. Similarly, constant values for each channel will be detected.

Channel Parameter / Tag
Diffuse ogl_diff, baseColorMap
Opacity ogl_alpha
Normal ogl_normalmap
Specular ogl_specmap/ogl_spec
Roughness ogl_roughmap/ogl_rough

Note that generated materials and textures need to be created as persistent files in order for Unity to keep references in saved scenes and for prefabs. These will be stored in the Assets/HoudiniEngineAssetCache/Working folder for unbaked assets, and in Assets/HoudiniEngineAssetCache/Baked folder for baked assets.

Instead of using the shipped shaders, custom shaders can be used for generating materials by changing the default shader paths in the Plugin Settings window, under the GEOMETRY section.


Material Overrides

The user can manually assign a Unity material to replace a generated or automatically assigned material. This can be done by selecting the output GameObject and replacing the materials on its MeshRenderer. Overridden materials will be kept on subsequent cooks, even if the generated material changes. To revert back to using the generated materials, open the ASSET OPTIONS section on the Houdini Engine UI and press the Reset Material Overrides button.