Houdini Engine for Unity
 All Files Pages
Attributes and Groups

Special groups and attributes are used when marshalling data between Houdini and Unity.

Standard Houdini Attributes

Certain standard Houdini attributes are used when marshaling data between Houdini and Unity.

Attribute Name Description
p position
rot rotation
Cd color
Alpha opacity
N normal
uv uv
uv2, uv3 additionnal uv channels
instance For object-level instancing, See Instancing

Houdini to Unity

This table lists special attributes which will be recognized when marshalling data from Houdini to Unity. Setting up those attributes on your asset will allow you to control and override some properties of the generated Unity geometry.

Attribute Name Owner Type Topic Description
unity_instance point, detail string Instancing Path in Unity project of an Asset to instance at the given owner transform. Should be relative to the project Assets folder (eg. "Assets/Prefabs/Hero.prefab").
unity_use_instance_flags point, detail int Instancing Use the prefab's original static, tag, and layer attributes when instancing (as opposed to the HDA parent's). Takes precedence over unity_static.
unity_material prim, detail string Materials Path in Unity of a Material asset to apply to a part. Should be relative to the project Assets folder (eg. "Assets/Materials/HeroMat.mat").
unity_tag prim, detail string Unity tag to set for generated GameObjects. Note that tag must already exist in Unity Editor scene.
unity_static prim, detail int Set to 1 to make generated GameObject static, or 0 for non-static.
lod_screensizes detail float arrayLevel of Detail Transition screensizes for LOD levels (range should be 0 to 1 or 1 to 100).
unity_layer prim, detail string Unity layer to set for generated GameObjects. Note that the layer must already exist in Unity Editor scene.
instance_prefix point, detail string Instancing Prefix to append to instance objects (eg. "City_Instance1" where "City" is the prefix).
unity_mesh_readable point, detail int Readable Meshes Generated meshes will be marked as readable if this is 1. By default, generated meshes are non-readable.
unity_split_attr point, detail int Instancing Indicates the name of another attribute to be used to split the instancers into multiple components depending on that second attributes values.

Houdini Heightfields to Unity Terrain

The following table lists special attributes which can be set on the height heightfield layer to specify an existing TerrainData asset file to used. A copy of the TerrainData asset file will be created on generation in Unity.

Attribute Name Owner Type Topic Description
unity_hf_terraindata_file prim string TerrainData Path in Unity project of a TerrainData asset to set as the Terrain Data. Relative to project Assets folder (eg. "Assets/Terrain/terlayer.asset").
unity_hf_terraindata_export_file prim string TerrainData Path to write the generated or copied TerrainData asset to.
unity_hf_tile point int TerrainData Specifies the terrain tile of a scatter point. Useful for tree instancing with the tile split node.

The following table lists special attributes which can be set on heightfield layers in order to set the corresponding Terrain Layer properties on the generated Unity Terrain. Note that height and mask layers are ignored when creating Terrain Layers, so these attributes must be set on other heightfield layers.

Attribute Name Owner Type Topic Description
unity_hf_terrainlayer_file prim string Height Field Layers Path in Unity project of a TerrainLayer asset to set as the Terrain Layer. Relative to project Assets folder (eg. "Assets/Terrain/base.terrainlayer").
unity_hf_texture_diffuse prim string Height Field Layers Path in Unity project of a Texture asset to set as the terrain layer's diffuse texture. Relative to project Assets folder (eg. "Assets/Texture/sand.png").
unity_hf_texture_mask prim string Height Field Layers Path in Unity project of a Texture asset to set as the terrain layer's mask texture. Relative to project Assets folder (eg. "Assets/Texture/sand.png").
unity_hf_texture_normal prim string Height Field Layers Path in Unity project of a Texture asset to set as the terrain layer's normal texture. Relative to project Assets folder (eg. "Assets/Texture/sand.png").
unity_hf_normal_scale prim float Height Field Layers Terrain layer's normal scale (float of size 1).
unity_hf_metallic prim float Height Field Layers Terrain layer's shader's metallic value (float of size 1, with value between 0 and 1).
unity_hf_smoothness prim float Height Field Layers Terrain layer's shader's smoothness value (float of size 1, with value between 0 and 1).
unity_hf_specular prim float array Height Field Layers Terrain layer's shader's specular color (float of size 4, with values between 0 and 1).
unity_hf_tile_offset prim float array Height Field Layers Terrain layer's texture's tile offset (float of size 2).
unity_hf_tile_size prim float array Height Field Layers Terrain layer's texture's tile size (float of size 2).

Unity to Houdini

This table lists special attributes which are created by the plug-in when marshaling data from Unity to Houdini.

Attribute Name Owner Type Topic Description
unity_material prim string Materials Path in Unity of a Material asset to apply to the mesh. Should be relative to the project Assets folder (eg. "Assets/Materials/HeroMat.prefab"). Automatically set when using an input mesh.
unity_input_mesh_name prim string Inputs Name of mesh's owner GameObject. Automatically set when using an input mesh.

These attributes will be available in Houdini when using Inputs to marshall data from Unity to Houdini.

These Standard Houdini Attributes will generally also be available: position (p), vertex colors (Cd, Alpha), normals (N) and UV sets (uv, uv2, uv3).

You can easily see these attributes and their values by troubleshooting the internal Houdini Scene (File > Open Scene In Houdini) after initializing your asset's Inputs.


Groups

Some special group names have naming schemes which specify generation behavior when marshalling data from Houdini to Unity.

Group Name Topic Description
collision_geo_* Colliders Prefix used for collider geometry generation (invisible)
convex_collision_geo_* Colliders Prefix used for convex collider geometry generation (invisible)
convex_collision_geo_trigger_* Colliders Prefix used for convex trigger collider geometry generation (invisible)
collision_geo_simple_* Colliders Prefix used for visible simple collider geometry generation. Accepted values are _box, _sphere, and _capsule.
collision_geo_simple_trigger_* Colliders Prefix used for visible simple trigger collider geometry generation. Accepted values are _box, _sphere, and _capsule.
rendered_collision_geo_* Colliders Prefix used for visible collider geometry generation
rendered_convex_collision_geo_* Colliders Prefix used for visible collider geometry generation
rendered_convex_collision_geo_trigger_* Colliders Prefix used for visible trigger collider geometry generation
rendered_collision_geo_simple_* Colliders Prefix used for visible simple collider geometry generation. Accepted values are _box, _sphere, and _capsule.
rendered_collision_geo_simple_trigger_* Colliders Prefix used for visible simple trigger collider geometry generation. Accepted values are _box, _sphere, and _capsule.
lod* Level of Detail Prefix used for defining mesh LOD level (e.g. lod0, lod1)

Primitives that belong to collision groups will be separately created as Mesh Collider components and added to the output GameObject. The rendered_collision_geo groups will have MeshRenderer and MeshFilter components as well.


Attributes Store

The Attributes Store feature allows to store attribute data in a script component (HEU_OutputAttributesStore) attached to the generated gameobject. This allows to bring in any supported attribute type (ints, floats, strings) from Houdini into Unity, to access them at a later point in time.

To use this feature for an HDA:

  1. Create attributes for points, primitives, or detail for a SOP geometry inside the HDA, with name and values set.
  2. Create another attribute with name hengine_attr_store of class Detail and type String.
  3. Specify the names of the attributes that you want stored, separated by commas (e.g. health,ammo,armor).

Now in Unity, when the HDA is cooked, the generated gameobject will have HEU_OutputAttributesStore script component attached. It will contain a map of attributes, which can be queried via script.

Note that you can also store Houdini native attributes such as P, rot, N, uv, etc.

Optional, but as a follow up, you can also attach a script to be called back automatically that can query and assign values from the attribute store. Check out the example HDA provided in Assets/Plugins/HoudiniEngineUnity/HDAs/HEUInstanceAttributesStore.hda.

Unity_AttributesStore.png