VoxelInstancer

Inherits: Node3D

Spawns items on top of voxel surfaces.

Description:

Add-on to voxel nodes, allowing to spawn static elements on the surface. These elements are rendered with hardware instancing, can have collisions, and also be persistent. It must be child of a voxel node.

Properties:

Type Name Default
int collision_update_budget_microseconds 500
float fading_duration 0.3
bool fading_enabled false
VoxelInstanceLibrary library
int mesh_lod_update_budget_microseconds 500
UpMode up_mode UP_MODE_POSITIVE_Y (0)

Methods:

Return Signature
void debug_dump_as_scene ( String fpath ) const
int debug_get_block_count ( ) const
Dictionary debug_get_block_infos ( Vector3 world_position, int item_id )
bool debug_get_draw_flag ( DebugDrawFlag flag ) const
Dictionary debug_get_instance_counts ( ) const
bool debug_is_draw_enabled ( ) const
void debug_set_draw_enabled ( bool enabled )
void debug_set_draw_flag ( DebugDrawFlag flag, bool enabled )
void remove_instances_in_sphere ( Vector3 center, float radius )

Enumerations:

enum UpMode:

  • UP_MODE_POSITIVE_Y = 0 --- Up is towards the positive Y axis. This is the default assumption in Godot.
  • UP_MODE_SPHERE = 1 --- Up is opposite from the direction where the terrain's origin is. May be used if your terrain is a planet for example.

enum DebugDrawFlag:

  • DEBUG_DRAW_ALL_BLOCKS = 0
  • DEBUG_DRAW_EDITED_BLOCKS = 1
  • DEBUG_DRAW_FLAGS_COUNT = 2

Constants:

  • MAX_LOD = 8

Property Descriptions

int collision_update_budget_microseconds = 500

Hints the maximum time that should be spent updating collisions that are based on distance (see VoxelInstanceLibraryMultiMeshItem.collision_distance). This time can still be exceeded if an operation takes longer, but then no further processing will occur until next frame.

float fading_duration = 0.3

How long it takes for fading to complete, in seconds (same for fading in and out). Used when fading_enabled is active.

bool fading_enabled = false

When enabled, a per-instance shader parameter will be updated when instances load in and out, so it can be used to apply a fading effect.

The material used by instances must have a shader that has a instance uniform vec2 u_lod_fade; property. X will animate from 0 to 1 during fade in and fade out. Y will be 1 when fading in, and 0 when fading out.

VoxelInstanceLibrary library

Library from which instances to spawn will be taken from.

int mesh_lod_update_budget_microseconds = 500

Hints the maximum time that should be spent updating mesh LODs (see "mesh LOD" properties on VoxelInstanceLibraryMultiMeshItem). This time can still be exceeded if an operation takes longer, but then no further processing will occur until next frame.

UpMode up_mode = UP_MODE_POSITIVE_Y (0)

Where to consider the "up" direction is on the terrain when generating instances. See also VoxelInstanceGenerator.

Method Descriptions

void debug_dump_as_scene( String fpath )

(This method has no documentation)

int debug_get_block_count( )

(This method has no documentation)

Dictionary debug_get_block_infos( Vector3 world_position, int item_id )

(This method has no documentation)

bool debug_get_draw_flag( DebugDrawFlag flag )

(This method has no documentation)

Dictionary debug_get_instance_counts( )

(This method has no documentation)

bool debug_is_draw_enabled( )

(This method has no documentation)

void debug_set_draw_enabled( bool enabled )

(This method has no documentation)

void debug_set_draw_flag( DebugDrawFlag flag, bool enabled )

(This method has no documentation)

void remove_instances_in_sphere( Vector3 center, float radius )

Removes all instances having their origin inside the given sphere. Coordinates are local to the instancer.

Generated on Jan 26, 2026