Houdini Engine for Unity
 All Files Pages
Houdini Assets

Houdini Asset

A Houdini Asset is created when loading a HDA file into an Unity project. This is done by either dragging & dropping a HDA into the Unity Hierarchy or Scene view, or via the menu command HoudiniEngine > Load Houdini Digital Asset.

When a HDA is loaded in Unity, the plug-in will load the HDA into the default Houdini Engine session, automatically cook it, and create a GameObject hierarchy containing relevant HDA meta information and the cooked output.

Files generated by the asset for persistent storage as required by Unity (i.e. Materials, Textures, Meshes) are stored in the Assets/HoudiniEngineAssetCache/Working folder. Each asset's data is contained in a subfolder with the same name as the asset, possibly with an integer at the end to produce a unique folder name. Note that when an asset is deleted in the Scene, its working folder will also be removed, unless the asset was saved in a Scene. As there is currently no way in Unity to check if an asset is used in other Scenes, it is left up to the user to decided whether to delete the asset's working folder after removing it from a saved Scene.

Note that the asset will be imported using relative path to the Unity project Assets folder.

Note that using the built-in duplicate or copy/paste mechanisms in Unity on the asset will not work properly. Instead use the Duplicate Asset button to duplicate the asset manually. See below.


Asset Hierarchy

The following shows the generated GameObject hierarchy for the EvergreenGenerator.otl asset.

Unity_AssetHierarchy.png

It is important to understand what each of the items are in this hierarchy. This hierarchy scheme is used for all representations of an asset in the Unity scene. There is a clear separation between plug-in data and the final outputs, allowing for flexible workflows where the plug-in is not needed or available.

Root GameObject - The root GameObject (EvergreenGenerator) is the parent for all generated GameObjects, and is used primarily to group the generated children under one transform. It contains the HEU_HoudiniAssetRoot component which is a lightweight script used to display the custom Inspector UI, as well as to activate any custom tools in the Scene view such as for the Curve Editor.

Asset Metadata (HDA_Data) - The HDA_Data child GameObject contains the single script component HEU_HoudiniAsset. This component is the main script for all plug-in interaction, and contains all the metadata and state information about the asset. In most cases, the user does not (and should not) modify this GameObject or its values in any way, though viewing its data could be helpful in understanding the structure of the asset, and troubleshooting issues with cooking and output. One key design feature of this component is that it is tagged as EditorOnly. This is a special Unity tag that automatically removes this GameObject and its stored data when building the project. This means that HEU_HoudiniAsset GameObjects are stripped from builds, and not available at runtime. Since the plug-in does not function at runtime, this tag will ensure the plug-in metadata is removed from builds and therefore reduces memory overhead. This also eliminates the need for baking. Further information about this script will be provided in the future.

Output GameObjects - All other GameObjects in the hierarchy are considered part of the output generated by cooking the asset. These usually contain the common Unity components such as a Mesh Renderer, Mesh Filter, Mesh Collider, and Materials. It is guaranteed by design that there will be no plug-in-specific components on these final output GameObjects. In fact, by simply copying & pasting these GameObjects and moving them out of the hierarchy, these will not have any dependency or linkage to the plug-in, and therefore can exist without the plug-in.


Asset Inspector UI

Unity_AssetInspectorUI.png

This shows the Inspector UI for the Houdini asset after it has been loaded and cooked. Note that this is a dynamic UI that displays items based on the type of asset, its display and editable nodes, and Parameters.

Generate

The Generate section contains functionality for loading and modifying the asset.

Rebuild Asset - Forces the asset to be reloaded in the Houdini Engine session, as well as the Unity scene. This would be the same action as manually deleting the asset and loading it. The latest parameter values are saved and reapplied on the asset after loading. Input node objects are reconnected as long as they are still available in the Unity scene. Material overrides will be reset though. Must use this to rebuild the asset if its HDA file was changed and saved in Houdini. Also useful if asset is in error state. Note that this will destroy and re-create the HDA_Data GameObject, all of the output GameObjects, and all input overrides, but will retain the root HEU_HoudiniAssetRoot GameObject, callback events, as well as any scripts assigned to it.

Recook Asset - Uploads only changed parameters, then forces the asset to be cooked in Houdini. Outputs (meshes, materials, etc.) are then re-generated. If the HDA file had been changed and resaved in Houdini, it is recommended to use Rebuild Asset instead.

Note that by default, when parameters change via the UI, the asset will automatically upload only the parameters that had changed and recook. Then only changed outputs are regenerated. This is done to speed up the cooking process. This can be turned off in the HDA Options section via the Auto-Cook On Parameter Change checkbox. If that is disabled, then the Recook Asset button allows the user to invoke the cooking process manually, which will upload the changed parameter values and recook everything. Turning off auto-cook can help in situations when changing a lot of parameters and not wanting to wait for cooking to finish.

Keep Only Output - Removes all Houdini Engine data which includes the HEU_HoudiniAssetRoot and HEU_HoudiniAsset scripts. It also destroys the loaded asset in the Houdini Engine session. It is similar to the other Bake functions, except that this produces no duplicate GameObjects. It is useful in cases where only one output of an asset is needed in a scene and the HDA no longer necessary.

Duplicate Asset - This is the only recommended way to duplicate or copy/paste an instantiated asset. This makes sure to instantiate a copy of the asset and its state correctly in the Houdini session, as well as all the inputs, overrides, etc.

Reset Parameters - This resets the parameters to their default saved values in the HDA. Resets all curve modifications and input node changes as well.


Bake

The Bake section contains functionality for generating copies of the output, as well as updating them. Updating previously baked outputs is a new feature in Version 2.

Bake GameObject - Creates a copy of the output in the Scene. The output will not contain any plug-in-specific data or components. Note that if the output has several GameObjects, there will be a root (empty) GameObject in order to retain the grouping. Otherwise if the output is a single GameObject, then the hierarchy will be flattened and only a single GameObject with no parent will be produced.

Bake Prefab - Creates a Prefab of the output in the Project. The Prefab is stored in Assets/HoudiniEngineAssetCache/Baked folder, under a new subfolder with the same name as the asset. If the subfolder name already exists, a unique name will be used containing an integer at the end. The subfolder will also contain Materials and Meshes produced and written to file storage, under their respective subfolders.

Bake Update - Updates previously baked out GameObjects and Prefabs. It should also work on any GameObject, even if it wasn't baked out before. It essentially copies the output GameObjects' components onto the target GameObjects. This is useful when wanting to simply update the output but retain all other data (i.e. a wheel that is already attached and positioned to a car). This accepts a dynamic list of target GameObjects and requires at least 1 item in the list. The list can contain any mix of standalone GameObjects and Prefabs. Note that if there are multiple GameObjects as part of the output, they will be matched by each GameObject's name. Therefore it is highly recommended not to change the output GameObject names if planning to use Bake Update on them.

Keep Previous Transform Values - Attempts to keep the relative transform values of the baked object on a Bake Update. Often useful for LODs.


Events

This section allows callbacks to be attached to each of the Generate and Bake functions after they have been invoked. This is useful for executing custom code and setup after generating, cooking, or baking. For example, after baking a new platform from an HDA, a custom script can setup the platform for the navigation system. See HoudiniEngineUnity/Scripts/Tests/HEU_AssetEventReceiverTest.cs for examples of callback functions.


HDA Options

Contains options for controlling the asset cook behaviour.

Unity_AssetOptions.png

Cook triggers:

Parameter Change - Automatically cook if any parameter has changed. Turn this off and cook manually via Recook Asset if cooking takes too long.

Transform Change - If the transform in Unity changes, then recook the asset automatically. This is useful if the transform is used in the node network for calculating final output.

Downstream Cooks - When the asset is cooked, will trigger a cook on other assets for which the given asset is an input.

Generate:

Use output nodes - Whether or not to use output nodes instead of the display flag.

LOD Groups - Whether to generate LOD Group with level of detail meshes for the output (see Level of Detail). Disabling this will merge all geometry groups. Only supported on Unity 2017.1 and newer.

Generate Normals - Whether to generate normals after cooking in Unity.

Generate Tangents - Whether to generate tangents after cooking in Unity.

UVs - Whether to generate UVs after cooking in Unity. This overrides the first UV set from Houdini.

Using Points - Whether to use Points as (shared) vertices instead of splitting vertices (default behavior). While this reduces vertex count, note that only Point attributes will be used. Therefore make sure that normals, tangents, colors, UVs, etc are owned by Points.

Miscellaneous:

Push Transform To Houdini - Update the asset in the Houdini Engine session with the transform values in Unity. For example, if the user moves the asset root, this position change is reflected in Houdini.

Ignore NonDisplay Nodes - If true, then only the final display geometry will be generated, and all others ignored.

Split Geos By Groups - Split the output geometry into separate game objects by group. Each group will then produce a gameobject with mesh and other components. Note that this feature is deprecated, and no longer supported. It is recommended to be only used for simple cases.

Other options:

Save HDA Preset - Save the asset's parameter preset to a file. This file will contain the current parameter preset, as well as the parameter presets of all curves in the asset. This file can be loaded by the Load HDA Preset button. It can be used to clone the asset's parameter values across scenes and projects, as well as managed by source control.

Load HDA Preset - Load a previously saved parameter preset file into this asset, then cook it with those values. The preset file must have been saved out by an asset that was instantiated by the same HDA as this asset.

Reset Material Overrides - Reset all material overrides on this asset. See Material Overrides.


Asset Parameters

Contains all the exposed parameters on the asset. This is a dynamically created section that displays each parameters based on its type. Most parameters are currently supported, except Ramps which will be fully supported in the future.