Houdini Engine for Unity
 All Files Pages
Meshes

Overview

Houdini Engine for Unity supports generating Unity meshes as output geometry, as well as uploading Unity meshes to Houdini as input geometry.


Input

By using Node Inputs or Object Path Input Parameter, Unity mesh geometry can be marshalled into Houdini. Assigned materials can be saved as primitive attributes with material paths, which will survive the roundtrip when exporting the same geometry back out to Unity.


Output

The geometry output of a Houdini asset is usually a Unity Mesh, stored on a MeshFilter or MeshCollider.

An asset usually contains Objects, which in turn contain Geos, which contain Parts. This structure dictates how Unity meshes are generated.

  • Object (OBJ) nodes are Houdini's transform nodes. They contain other OBJ nodes or geometry (SOP) nodes.
  • Geo (SOP) nodes are Houdini's geometry container nodes. They do not contain geometry directly, rather they contain Parts.
  • Parts contain the actual geometry and attribute data that is used to generate meshes.

Typically all geometry in a Part will be generated as a single mesh. Only collision groups or LOD groups can be used to split up the geometry into separate meshes. Other groups will be either combined into a single mesh, or if LOD groups are present, the those other geometry are ignored.

Note that, by default, meshes will be generated using split vertices (i.e. each triangle will have unique vertices). This can be changed to using Points (shared vertices) by enabling Generate Mesh Using Points checkbox in the ASSET OPTIONS section.


Level of Detail

Level of Detail (LOD) meshes can be generated by using LOD Groups. Note that LOD is only supported for Unity 2017.1 and newer.

In Houdini, add the geometry for each LOD to a primitive group with a name starting with "lod". The alphabetical order of the group names will dictate the LOD order (i.e. lod0, lod1, lod2, etc).

Unity_LODAssetHoudini.png

When the plug-in encounters these groups, a LODGroup component is added to the output GameObject, and child GameObjects are created containing the LOD meshes (one child for each LOD group). Make sure that the Use LOD Groups checkbox under the ASSET OPTIONS section is enabled (if not, enable then Recook the asset).

Unity_LODAssetUI.png

The screen relative transition height values used for the LODGroup can be specified by a detail float array attribute named "lod_screensizes". This float array should contain the corresponding number of float values, each of which should be in the range between 0 and 1, or between 1 to 100. For the later case, values over 1 will be divided by 100 in order to be compatible with Unity's LOD system. If this attribute is not specified, default values will be used where each LOD will receive an equal transition range between 0 and 1.

Note that packed geometry inside a LOD group will not be created as a LOD mesh. Rather it will be treated as instanced geometry (see Packed Primitives).


Colliders

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

Mesh Colliders:

  • collision_geo Adds a non-convex, non-rendered mesh collider.
  • rendered_collision_geo Adds a non-convex, rendered mesh collider.

Simple Colliders (Unity Primitive Colliders):

  • 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:

  • convex_collision_geo Adds a convex non-rendered mesh collider.
  • rendered_convex_collision_geo Adds a convex, rendered mesh collider.

Triggers:

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.

  • 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

The geometry with one of the above grouping will be generated as a separated mesh from other geometry, and set as the mesh in the MeshCollider component.


Topology: Triangles and Quads

By default, the plugin always generates meshes with Triangle topology, even if the geometry Connectivity is set to Quadrilaterals. Instead, Quad topology meshes can be generated by doing the following:

  1. In Plugin Settings, under the GEOMETRY section, change the Max Vertices Per Primitive to 4.
  2. Make sure the geometry Connectivity is set to Quadrilaterals or make sure that the geometry has all quads.
  3. Recook the HDA. It should produce quad topology meshes.

Notes:

  • Even when quad topology is used, Unity will display the wireframe of the mesh with triangles. To query the mesh topology, select the GameObject, then go to menu HoudiniEngine > Utility > Query Mesh Topology. The vertex count will also be lower than with triangles.
  • Mixing topology in the same mesh (i.e. triangles and quads) is not supported, and will result in error. If mixed topology is required, then you must split the mesh.
  • Max Vertices Per Primitive in Plugin Settings must be either 3 or 4. When set to 3, it will always generate triangles. When set to 4, it will generate triangles or quads depending on the connectivity.

Readable Meshes

By default, the plugin will generate non-readable meshes. Yet readable meshes can be generated by specifying the integer attribute named unity_mesh_readable with a value of 1.