Houdini Engine for Unreal
 All Files Pages
Materials

Materials can be assigned to generated meshes by either specifying an existing Unreal Material Asset By Attribute, or by allowing the plug-in to attempt to Generate generate a new Unreal material based on the Houdini material that is found.

By Attribute

The special Unreal to Houdini 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 it's 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.

This is accomplished by reading parameter values on the associated SHOP or VOP nodes.

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

Channel Parameter / Tag
Diffuse ogl_diff, basecolor
Opacity ogl_alpha
OpacityMask ogl_opacitymap
Normal ogl_normalmap, normalTexture
Specular ogl_specmap/ogl_spec, reflect_texture/reflect
Roughness ogl_roughmap/ogl_rough, rough_texture/rough
Metallic metallic_texture / metallic
Emissive ogl_emit, emitcolor

Note: ogl_normalmap_type will be read to determine the space of the normal map ( Tangent vs World )

Then 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.

Material Instances

It is possible to automatically create a Material Instance from a given Unreal Material asset by using the unreal_material_instance string attribute, and using the path to the material asset as the parameter's 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.

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 (like BlendMode, PhysMaterial, TwoSided etc.) but also for the "custom" material parameters that expose scalar, vector or texture parameters you created 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.
  • Texture parameters can be changed by String attributes. To set that parameter to an already 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 is generating only one material, you can simply set the attribute to the material channel you want to use (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 that generates the material before the desired channel. ( for example "testgeometry_squab1/shopnet1/SquabSkin/diffuse" ).
  • 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).