HEGoHeightfieldInputNode

Inherits: HEGoBaseInputNode < HEGoTransformableNamedNode < HEGoTransformableNode < HEGoBaseNode < HEGoTrackableNode < RefCounted

Builds Houdini HeightField input layers from Godot images.

Description

This node creates or recreates a HeightField input network and writes voxel data for height, mask, and any additional named layers.

Each layer entry in the input dictionary is expected to be a dictionary with optional image (Image) and attrs (Dictionary) keys. The first valid image determines resolution. Missing height or mask layers are auto-generated as zero-filled layers.

Layer names are normalized to lowercase and trimmed before processing.

Calling set_layers() rebuilds the internal heightfield input node network for the new layer payload.

Methods

HEGoTask

instantiate()

HEGoTask

set_layers(layers: Dictionary, voxel_size: float = 1.0, height_scale: float = 1.0, force: bool = false)


Method Descriptions

HEGoTask instantiate() 🔗

Submits a task to create a Houdini HeightField input network for this wrapper.

If the node is already instantiated, the call returns immediately.

The method requires an active Houdini session. On success, it stores the main node id plus internal height, mask, and merge node ids, then registers this wrapper with the session manager.

On failure, all stored ids are reset to invalid values and an error is logged.


HEGoTask set_layers(layers: Dictionary, voxel_size: float = 1.0, height_scale: float = 1.0, force: bool = false) 🔗

Submits a task to upload all supplied layers into a newly created HeightField input node.

voxel_size must be greater than 0 and controls XY world scale. height_scale must be greater than 0 and is applied only to the height layer values.

Expected layers structure:

{
    "height": {
        "image": Image,             # optional but usually provided
        "attrs": {                  # optional primitive attributes
            "name": Variant
        }
    },
    "mask": {
        "image": Image,
        "attrs": {}
    },
    "water": {
        "image": Image,
        "attrs": {
            "hego_material": "Mud",
            "hego_lod": 1
        }
    }
}

How entries are interpreted:

  • Top-level keys are layer names (for example height, mask, water).

  • Each top-level value should be a Dictionary. Non-dictionary entries are skipped.

  • image should be an Image. If present, it is sampled to voxel values.

  • attrs is optional primitive metadata written onto that layer volume.

Resolution and defaults:

  • The first valid image found across all layers sets the heightfield resolution.

  • If no valid image exists in any layer, the task fails with an error.

  • If height and/or mask are missing, they are created as zero-filled layers.

  • Extra layers beyond height and mask are created as additional heightfield volume nodes.

Notes on values:

  • height_scale affects only the height layer.

  • Layer images are converted or resized as needed to match the final resolution.

  • Primitive attrs values are expected to be bool, int, float, String, or Vector3.

Failure behavior:

  • If voxel_size or height_scale is less than or equal to 0, the call is rejected.

  • If no active Houdini session exists, layer upload cannot proceed.

  • Any HAPI node creation or write failure logs an error and aborts the current layer build.

Layer content is hashed internally (including image pixel data). If the layers, voxel size, and height scale are all identical to the previous call a no-op task is returned, unless force is true. Pass force when image data may have been modified in-place (for example Terrain3D sculpting).


Class Registration

  • Kind: Concrete


Inherited Methods