On this page |
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).
The plugin will also attempt to generate HDRP/URP materials as of Houdini 18.5.554. These materials are intended to be similar to their BIRP equivalents, and all currently supported channels should also work with HDRP/URP. Note that if you have a HDRP project, you may get a non-fatal error regarding the deserialization of URP shaders and vice versa. This error can be ignored without any issues. Alternatively, you can avoid importing the shadergraphs of the render pipeline that you are not using. (i.e. by deleting the URP folder if you are using HDRP, or the HDRP folder if you are using URP)
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, basecolor, ogl_tex1, basecolor_texture |
Opacity |
ogl_alpha, opac, ogl_opacitymap, opaccolor_texture, ogl_transparency |
Normal |
ogl_normalmap, baseNormal_texture |
Specular |
ogl_spec, reflect, ogl_specmap, reflect_texture |
Roughness |
ogl_rough, rough, ogl_roughmap, rough_texture |
Metallic |
ogl_metallic, metallic, ogl_metallicmap, metallic_texture |
Emission |
ogl_emit, emitcolor, ogl_emissionmap, emitcolor_texture |
Occlusion |
ogl_occlusionmap |
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.