VoxelMesherTransvoxel

Inherits: VoxelMesher

Implements isosurface generation (smooth voxels) using the Transvoxel algorithm.

Properties:

Type Name Default
float edge_clamp_margin 0.02
bool mesh_optimization_enabled false
float mesh_optimization_error_threshold 0.005
float mesh_optimization_target_ratio 0.0
bool textures_ignore_air_voxels false
TexturingMode texturing_mode TEXTURES_NONE (0)
bool transitions_enabled true

Methods:

Return Signature
ArrayMesh build_transition_mesh ( VoxelBuffer voxel_buffer, int direction )

Enumerations:

enum TexturingMode:

  • TEXTURES_NONE = 0 --- Disables texturing information. This mode is the fastest if you can use a shader to apply textures procedurally.
  • TEXTURES_MIXEL4_S4 = 1 --- Expects voxels to have 4 4-bit indices packed in 16-bit values in VoxelBuffer.CHANNEL_INDICES, and 4 4-bit weights in VoxelBuffer.CHANNEL_WEIGHTS. Adds texturing information as 4 texture indices and 4 weights, encoded in CUSTOM1.xy in Godot fragment shaders, where x and y contain 4 packed 8-bit values. In cases where more than 4 textures cross each other in a 2x2x2 voxel area, triangles in that area will only use the 4 indices with the highest weights. A custom shader is required to render this, usually with texture arrays to index textures easily.
  • TEXTURES_SINGLE_S4 = 2 --- Expects voxels to have a 8-bit texture index in the VoxelBuffer.CHANNEL_INDICES channel. Adds texturing information as 4 texture indices and 4 weights, encoded in CUSTOM1.xy in Godot fragment shaders, where x and y contain 4 packed 8-bit values. In cases where more than 4 textures cross each other in a 2x2x2 voxel area, triangles in that area will only use the 4 indices with the highest weights. A custom shader is required to render this, usually with texture arrays to index textures easily.

Constants:

  • TEXTURES_BLEND_4_OVER_16 = 1 --- This constant is deprecated. Use TEXTURES_MIXEL4_S4 Legacy alias for TEXTURES_MIXEL4_S4.

Property Descriptions

float edge_clamp_margin = 0.02

When a marching cube cell is computed, vertices may be placed anywhere on edges of the cell, including very close to corners. This can lead to very thin or small triangles, which can be a problem notably for some physics engines. this margin is the minimum distance from corners, below which vertices will be clamped to it. Increasing this value might reduce quality of the mesh introducing small ridges. This property cannot be lower than 0 (in which case no clamping occurs), and cannot be higher than 0.5 (in which case no interpolation occurs as vertices always get placed in the middle of edges).

bool mesh_optimization_enabled = false

(This property has no documentation)

float mesh_optimization_error_threshold = 0.005

(This property has no documentation)

float mesh_optimization_target_ratio = 0.0

(This property has no documentation)

bool textures_ignore_air_voxels = false

(This property has no documentation)

TexturingMode texturing_mode = TEXTURES_NONE (0)

(This property has no documentation)

bool transitions_enabled = true

(This property has no documentation)

Method Descriptions

ArrayMesh build_transition_mesh( VoxelBuffer voxel_buffer, int direction )

Generates only the part of the mesh that Transvoxel uses to connect surfaces with different level of detail. This method is mainly for testing purposes.

Generated on Jan 26, 2026