Houdini Engine for Unity
 All Files Pages
Painting and Editing Attributes

The Unity plug-in has specially built tools to paint and edit attributes of editable nodes from within Unity. This allows for assets to be manipulated at the attribute level from within Unity.

Note that the plug-in only supports painting and editing Point attributes of Editable nodes. The attribute types currently supported for painting and editing are Float, Int, and String. In addition, the position (P) attribute will not be editable.

To make a node editable, in Houdini, add its name to the Editable Nodes field in the Node section of the Edit Operator Type Properties window for the asset.

Unity_EditableNode.png

In Unity, check the Enable Editable Node Tools checkbox in the ASSET OPTION section. This will display the UI for the Painting and Editing tools.

Unity_PaintEditTools.png

The Painting and Editing Tools UI will then displayed in the Scene view. When painting or editing attributes, the geometry displayed will be switched to show the editable node's output geometry.


Multiple Editable Nodes

Special care must be taken when dealing with multiple editable nodes in the same asset network. When an editable node's attributes are uploaded into Houdini, it is locked and its inputs are no longer cooked. Any subsequent cooks on this node will not use changes in the upstream inputs. Therefore, if multiple editable nodes are present, applying changes to nodes downstream in the network will lock them and they will not be able to take input from the upstream editable nodes. Another issue is that the order of when the changes are applied can also affect the final outcome. Upstream nodes should have their changes applied before downstream nodes. Otherwise the upstream changes will be irrelevant. The View UI allows to work around these issues.

Unity_EditNodeUI.png

Always Cook Inputs allows to override the lock by unlocking the node, revert its local changes, cooking the upstream inputs, and then applying the local attribute changes. This ensures the node always uses the latest upstream inputs.

Additionally, the EDIT ORDER list contains editable nodes found in the asset. This list will be displayed in order of when their edits are applied (first to last). This list should be re-ordered such that upstream nodes are higher in the list than downstream nodes. Note that by default, when initially loading the asset, nodes will be alphabetically ordered by their names (e.g. firstEdit, secondEdit). This allows to specify the edit order in Houdini by using appropriate names for the editable nodes.


Painting Attributes

The Paint Attribute tool allows to paint directly on the surface of the editable node's geometry. The attribute value of each point that the brush encounters is modified according to the settings in the Paint tool.

Unity_PaintTool.png

The following describes each field in the Paint Tool's UI:

  • Editable Node - Currently selected editable node. If multiple editable nodes are available, this allows to select one for painting. The geometry displayed when painting is the output geometry of the selected editable node.
  • Attribute - Currently selected Point attribute of the selected editable node. Painting will only affect this attribute.
  • Paint Values - Value to apply to the attribute when painting.
  • Affected Area Color - Simply for visualization, this is the debug color to show painted area. The affected area is reset on each mouse release.
  • Cook On Mouse Release - Whether to cook the asset once stopped painting. Some assets might take a look time to cook, therefore for usability purposes, this allows to turn off auto-cooking. Unchecking this will disable the auto-cook that happens when the user releases the mouse after painting. Instead, the user can manually invoke Recook Asset whenever necessary.
  • Brush Size - The radius of the painting brush.
  • Brush Opacity - Similar to the Opacity field in Houdini's Paint node, this affects the blending factor when merging painting and original attribute values.
  • Merge Mode - Similar to the Merge Mode field in Houdini's Paint node, this dictates how to blend the painting and original attribute values.
    • Replace - Blend between the original attribute value and painting value according to the brush opacity.
    • Add - Add the paint value to the original attribute value.
    • Subtract - Subtract the paint value from the original attribute value.
    • Multiply - Result of multiplying the paint value by the original attribute value then blending into the original attribute value by the brush opacity.
  • Handle Color - Color of the paint brush handle in the viewport.
  • Fill - Apply the paint value to all points according to the Merge Mode and Brush Opacity.

Color Attribute

The Color attribute (Cd) is treated specially by the Painting tool. It is automatically converted from a Float array (internal representation) into a Color field in Unity.

Unity_PaintColorAttribute.png

To paint vertex colors on your geometry, simply add the Paint SOP to your asset network, and add the node's name to the Editable Nodes field. In fact, any editable node that has Cd attribute will allow to paint vertex colors.


Editing Attributes

The Edit Attribute tool allows to select one or more points and set the attribute values directly. Each point in the geo is displayed as a selectable cube. Their values can be changed by entering the new value into the Selected Pts Values field.

Unity_EditAttributeTool.png

The following describes each field in the Paint Tool's UI:

  • Editable Node - Currently selected editable node. If multiple editable nodes are available, this allows to select one for editing.
  • Attribute - Currently selected Point attribute of the selected editable node. Editing will only affect this attribute.
  • Selected Pts Values - Value to set on the attribute when editing.
  • Show Only Edit Geometry - If enabled, will only display the current editable node's geometry. Makes it easier to select points.
  • Pt Size - The size of the cube meshes displayed as points.
  • Unselected Pt Color - Color to display unselected points.
  • Selected Pt Color - Color to display for selected points.
  • # of Selected Pts - Number of currently selected points.
  • Select All - Select all points in the editable node.