Houdini 20.5 Unity

Attributes and Groups

List of attributes and groups to use between Houdini and Unity

On this page

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

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

General

Attribute Name

Owner

Type

Description

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

unity_layer

prim, detail

string

Unity layer to set for generated GameObjects. Note that the layer must already exist in Unity Editor scene

Instancers

Attribute Name

Owner

Type

Description

unity_instance

point, detail

string

Path in Unity project of an Asset to instance at the given owner transform. Should be relative to the project Assets folder

example: Assets/Prefabs/Hero.prefab

unity_use_instance_flags

point, detail

int

Use the prefab’s original static, tag, and layer attributes when instancing (as opposed to the HDA parent’s). Takes precedence over unity_static

instance_prefix

point, detail

string

Prefix to append to instance objects example: City_Instance1 (Cityis the prefix)

unity_split_attr

point, detail

int

Indicates the name of another attribute to be used to split the instancers into multiple components depending on that second attributes values

Level of Detail

Attribute Name

Owner

Type

Description

lod_screensizes

detail

float array

Transition screensizes for LOD levels (range should be 0 to 1 or 1 to 100)

Materials

Attribute Name

Owner

Type

Description

unity_material

prim, detail

string

Path in Unity of a Material asset to apply to a part. Should be relative to the project Assets folder

example: Assets/Materials/HeroMat.mat

Meshes

Attribute Name

Owner

Type

Description

unity_mesh_readable

point, detail

int

Generated meshes will be marked as readable if this is 1. By default, generated meshes are non-readable

Terrain Data

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

Description

unity_hf_terraindata_file

prim

string

Path in Unity project of a TerrainData asset to set as the Terrain Data. Relative to project Assets folder

example: Assets/Terrain/terlayer.asset

unity_hf_terraindata_export_file

prim

string

Path to write the generated or copied TerrainData asset to

unity_hf_tile

point

int

Specifies the terrain tile of a scatter point. Useful for tree instancing with the tile split node

Heightfield Layers

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

Description

unity_hf_terrainlayer_file

prim

string

Path in Unity project of a TerrainLayer asset to set as the Terrain Layer. Relative to project Assets folder

example: Assets/Terrain/base.terrainlayer

unity_hf_texture_diffuse

prim

string

Path in Unity project of a Texture asset to set as the terrain layer’s diffuse texture. Relative to project Assets folder

example: Assets/Texture/sand.png

unity_hf_texture_mask

prim

string

Path in Unity project of a Texture asset to set as the terrain layer’s mask texture. Relative to project Assets folder

unity_hf_texture_normal

prim

string

Path in Unity project of a Texture asset to set as the terrain layer’s normal texture. Relative to project Assets folder

unity_hf_normal_scale

prim

float

Terrain layer’s normal scale (float of size 1)

unity_hf_metallic

prim

float

Terrain layer’s shader’s metallic value (float of size 1, with value between 0 and 1)

unity_hf_smoothness

prim

float

Terrain layer’s shader’s smoothness value (float of size 1, with value between 0 and 1)

unity_hf_specular

prim

float array

Terrain layer’s shader’s specular color (float of size 4, with values between 0 and 1)

unity_hf_tile_offset

prim

float array

Terrain layer’s texture’s tile offset (float of size 2)

unity_hf_tile_size

prim

float array

Terrain layer’s texture’s tile size (float of size 2)

Terrain Detail Layers

Attribute

Description

unity_hf_layer_type

Converts the height field layer to a detai llayer. Set a Primitive String on the layer with a value detail.

unity_hf_detail_prototype_prefab

unity_hf_detail_prototype_texture

unity_hf_detail_prototype_bendfactor

Set a Primitive Float attribute with a bend factor value.

unity_hf_detail_prototype_drycolor

Set a Primitive Color (4 float) attribute with dry color value.

unity_hf_detail_prototype_healthycolor

Set a Primitive Color (4 float) attribute with healthy color value.

unity_hf_detail_prototype_maxheight

Set a Primitive Float attribute with maximum height value.

unity_hf_detail_prototype_maxwidth

Set a Primitive Float attribute with maximum width value.

unity_hf_detail_prototype_minheight

Set a Primitive Float attribute with minimum height value.

unity_hf_detail_prototype_minwidth

Set a Primitive Float attribute with minimum width value.

unity_hf_detail_prototype_noisespread

Set a Primitive Float attribute with a noise spread value.

unity_hf_detail_prototype_rendermode

Set a Primitive Integer attribute with a DetailRenderMode value of 0 for GrassBillboard, 1 for VertexLit, and 2 for Grass (Default).

Detail Layers - Global Detail Properties

  • On the height layer, the following attributes can be specified to set the detail values for the generated TerrainData:

Attribute

Description

unity_hf_detail_distance

Set a Detail Integer attribute with value from 0 to 250 for Detail Distance

unity_hf_detail_density

Set a Detail Float attribute with value from 0 to 1 for Detail Density

unity_hf_detail_resolution_patch

Set a Detail Integer attribute with value from 8 to 128 for Density Resolution Per Patch

Tree Instances

Tree Instances are defined using the following Point attributes after the HeightField Scatter node in the network. Automatically setting Terrain tree instances is only available for Unity 2019.1 or newer.

Attribute

Description

unity_hf_treeinstance_prototypeindex

Set the index (Integer) of the TreePrototype to use (starting at 0). The index refers to the TreePrototype definition described above

unity_hf_treeinstance_heightscale

Set the height scale (Float) of the TreePrototype

unity_hf_treeinstance_widthscale

Set the width scale (Float) of the TreePrototype

unity_hf_treeinstance_lightmapcolor

Set the lightmap color (4 Float) of the TreePrototype

Cd

Set the color (4 Float) of the TreePrototype

orient

Set the rotation of the TreePrototype

Unity to Houdini

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

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 see these attributes and their values by troubleshooting the internal Houdini Scene (File ▸ Open Scene In Houdini) after initializing your asset’s Inputs.

Materials

Attribute Name

Owner

Type

Description

unity_material

prim

string

Path in Unity of a Material asset to apply to the mesh. Should be relative to the project Assets folder. Automatically set when using an input mesh

Inputs

Attribute Name

Owner

Type

Description

unity_input_mesh_name

prim

string

Name of mesh’s owner GameObject. Automatically set when using an input mesh

Groups

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

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.

Collision

Colliders can be automatically added to generated meshes by using keywords in group names for geometry. These group names are:

Mesh Collision

Group Name

Description

collision_geo

Adds a non-convex, non-rendered mesh collider

rendered_collision_geo

Adds a non-convex, rendered mesh collider

Simple Collision

Known as Unity Primitive Collision

Group Name

Description

collision_geo_simple_box

Adds a simple box collider (ignores geo in group). It will be an axis-aligned box with dimensions encapsulating all the vertices in the geo group

collision_geo_simple_sphere

Adds a simple sphere collider (ignores geo in group). It will be an axis-aligned sphere with dimensions encapsulating all the vertices in the geo group

collision_geo_simple_capsule

Adds a simple capsule collider (ignores geo in group). It will be an axis-aligned capsule with dimensions encapsulating all the vertices in the geo group

rendered_collision_geo_simple_box

Adds a simple box collider with geometry created as mesh. It will be an axis-aligned box with dimensions encapsulating all the vertices in the geo group

rendered_collision_geo_simple_sphere

Adds a simple sphere collider with geometry created as mesh. It will be an axis-aligned sphere with dimensions encapsulating all the vertices in the geo group

rendered_collision_geo_simple_capsule

Adds a simple capsule collider with geometry created as mesh. It will be an axis-aligned capsule with dimensions encapsulating all the vertices in the geo group

Convex Collision

Group Name

Description

convex_collision_geo

Adds a convex non-rendered mesh collider

rendered_convex_collision_geo

Adds a convex, rendered mesh collider

Triggers collision

Group Name

Description

Add trigger in the names above in order to convert the collider into a trigger (i.e. enable the Is Trigger toggle). Note that for Mesh Colliders, they must be convex. The geometry will be generated as a separated mesh from other geometry, and set as the mesh in the MeshCollider component.

  • convex_collision_geo_trigger

  • rendered_convex_collision_geo_trigger

  • collision_geo_simple_trigger_box

  • collision_geo_simple_trigger_sphere

  • collision_geo_simple_trigger_capsule

  • rendered_collision_geo_simple_trigger_box

  • rendered_collision_geo_simple_trigger_sphere

  • rendered_collision_geo_simple_trigger_capsule

Level of Detail

lod

Prefix used for defining mesh LOD level (e.g. lod0, lod1)

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

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.

You can also store Houdini native attributes such as P, rot, N, uv, etc.

Optionally, you can 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

Getting started

Project Setup

Using Houdini Engine

Reference