Houdini Engine for Unreal
 All Files Pages
Materials

Materials can be assigned to meshes generated by the plug-in in two different ways:

  • by using an existing Unreal Material Asset and specifying it By Attribute.
  • by allowing the plug-in to attempt to Generate a new Unreal material based on the Houdini material found in the asset.

Houdini engine can also automatically create Material Instances from existing Unreal Material and procedurally change parameters on these.

By Attribute

The special Unreal to Houdini primitive attribute unreal_material can be used to specify an Unreal material asset to apply to a given primitive.

This attribute should have the path to the asset as its string value. The path to the material asset can be obtained by right-clicking on it and choosing Copy reference in the context menu.

In a similar way, it is also possible to automatically create a Material Instance of a given Unreal material asset. Please see Material Instances for more information on the subject.

Generate

Optionally, the plug-in can attempt to generate an Unreal material that matches a material applied in Houdini.

The shop_materialpath primitive attribute is read for each primitive/face in the geometry produced, and an Unreal material will be created for each unique material listed in this manner, by reading parameter values on the associated SHOP or VOP nodes.

Constant values, colors and textures are generated by copying the data read from a giveb set of parameters/tagged parameters to the associated channel in the unreal material.

The following tables list the names of the parameters that will be used to generate a given material channel in Unreal. If the Houdini Material node applied to the mesh does not have a parameter that corresponds to the following names, it will use any parameter available on the material node that has the corresponding "compatibility tag".

Unreal Material Channel Parameter Name Compatibility Tag
Base Color basecolor ogl_diff
Base Color (Texture) basecolor_texture ogl_tex1
Metallic metallic -
Metallic (Texture) metallic_texture -
Specular reflect ogl_spec
Specular (Texture) reflect_texture ogl_specmap
Roughness rough ogl_rough
Roughness (Texture) rough_texture ogl_roughmap
Emissive Color emitcolor ogl_emit
Emissive Color (Texture) emitcolor_texture -
Opacity opac ogl_alpha
Opacity Mask (Texture) opaccolor_texture ogl_opacitymap
Normal (Texture) normalTexture ogl_normalmap
Normal Map Type (Tangent/World) - ogl_normalmap_type
Note
ogl_normalmap_type will be read to determine the space of the normal map ( Tangent vs World ). If the corresponding parameter is set to "World Space", then the material bTangentSpaceNormal uproperty will be set to false, and the normal map will be considered in World space, else the normal map will be considered in Tangent space.

An Unreal Material that connects Sampler nodes for those new texture assets into the Material results will be generated. This will trigger a recompilation of the associated shaders for the new Materials which may take some time.

Please note that textures are required to be cooked to a file. Textures created by Houdini Engine will be created in the cook temp folder (HoudiniEngine/Temp), do not forget to save them with your level.

Here is a simple example showing how to generate materials from your HDA:

  • The mesh generated in your HDA needs to have UVs.
  • Create a material sub network in your HDA (matnet).
  • Create a Principled Shader in the material subnet.
  • At the geo/sop level, add a material node to your generated geometry, pointing to the principled shader in the material subnetwork created before.

When instantiated in Unreal, the following principled shader parameters will be converted to an Unreal Material:

Unreal Material Channel Principled Shader Parameter Parameter Name Compatibility Tag
Base Color Surface/Basic/Base Color basecolor ogl_diff
Base Color (Texture) Textures/Base Color/Texture basecolor_texture ogl_tex1
Metallic Surface/Specular/Reflection/Metallic metallic -
Metallic (Texture) Textures/Metallic/Texture metallic_texture -
Specular Surface/Specular/Reflection/Reflectivity reflect -
Specular (Texture) Textures/Reflectivity/Texture reflect_texture -
Roughness Surface/Specular/Roughness rough ogl_rough
Roughness (Texture) Textures/Roughness/Texture rough_texture ogl_roughmap
Emissive Color Surface/Emission/Emission Color emitcolor ogl_emit
Emissive Color (Texture) Textures/Emission/Texture emitcolor_texture -
Opacity Mask Textures/Opacity/Texture opaccolor_texture ogl_opacitymap
Normal (Texture) Bumps&Normals/Base/Texture Path baseNormal_texture ogl_normalmap
Normal Space Bumps&Normals/Base/Vector Space baseNormal_vectorSpace ogl_normalmap_type

Material Instances

It is possible to automatically create a Material Instance from a given Unreal Material asset.

To do so, simply assign the unreal_material_instance primitive attribute, and using the path to the material asset as the parameter's string value. That path can be obtained by right-clicking on the asset and choosing Copy reference in the context menu.

Upon cook, a new Material instance of the source Unreal Material will be created in the cook temp folder, and assigned to the generated geometry.

For Landscapes , unreal_material_instance can be used for the Landscape Material, and unreal_material_hole_instance can be used for the hole material.

Material Instance Parameters

When creating a material instance in this way, it is possible to control and modify material parameters via attributes. Material parameters can be changed via the generic unreal_material_parameter_ prefix. This works in a similar way than the Generic UProperty Attributes do.

Simply add a detail or primitive attribute starting with unreal_material_parameter_, then append the name of the material parameter you wish to modify to it (without spaces). Upon cook, Houdini Engine will try to find the corresponding material parameter on the generated instance, and will override and set its value to the one you specified in the attribute.

This system works both for the "standard" material parameters that are always generated by Unreal when creating a material instance ( BlendMode, PhysMaterial, TwoSided etc.) but also for the "custom" material parameters that expose scalar, vector or texture parameters defined in your material.

For example:

  • To set the "Diffuse Boost" parameter to 2.0, add a unreal_material_parameter_diffuseboost detail attribute to your asset, and set its value to 2.0 (Float attribute).
  • To change the "Blend Mode" parameter from the default "Opaque" value, to "Additive", add a unreal_material_parameter_blendmode detail attribute to your asset, and set its value to either "additive" (String attribute) or 3. (Float or Integer attribute).
  • To change a custom "My Color" Vector parameter that you created in your material, add a unreal_material_parameter_mycolor detail attribute, Float with a tuple size of 4, and set its value to the desired color value, ( 1.0, 0.0, 0.0, 1.0 ) for a bright red.

This system currently supports 4 different types of material parameters:

  • Scalar parameters can be controlled with single tuple attributes (Float or Integer).
  • Vector parameters are controlled with Float or Integer attributes with a tuple size of 4 or 3. Float attributes will be considered as a FLinearColor in Unreal, whereas Integer attributes will be interpreted as a FColor in Unreal.
  • Enum parameters (like "Blend Mode") can be set either by using the string value of the enum or the integer value of int (starting from zero).
  • Texture parameters can be changed by String attributes. To use an existing unreal texture asset, you can simply use the asset's unreal path ( obtained by right clicking on it and choosing Copy Reference ). To use a texture generated by the current Houdini Asset, you have two options. First, if your asset generates only one material, you can simply set the attribute to the material channel you want to use (basecolor (or diffuse), normal, specular, roughness, emissive, metallic, opacitymask.. ). If your assets generates multiple materials, then you need to add the relative path to the SHOP node (or principled shader node) that generates the material before the desired channel. ( for example "testgeometry_squab1/shopnet1/SquabSkin/diffuse" ). Please note that this path is relative to your asset node.