VoxelInstanceGenerator

Inherits: Resource

Decides where to spawn instances on top of a voxel surface.

Description:

Generates the necessary information to spawn instances on top of a voxel surface. This may be used by a VoxelInstancer.

Note: to generate voxels, see VoxelGenerator.

Properties:

Type Name Default
float density 0.1
int emit_mode 0
float max_height 3.40282e+38
float max_scale 1.0
float max_slope_degrees 180.0
float min_height 1.17549e-38
float min_scale 1.0
float min_slope_degrees 0.0
Noise noise
int noise_dimension 1
VoxelGraphFunction noise_graph
float noise_on_scale 0.0
float offset_along_normal 0.0
bool random_rotation true
bool random_vertical_flip false
int scale_distribution 1
float vertical_alignment 1.0

Enumerations:

enum EmitMode:

  • EMIT_FROM_VERTICES = 0 --- Use vertices of the mesh to spawn instances. This is the fasted option, but can produce noticeable patterns.
  • EMIT_FROM_FACES_FAST = 1 --- Uses faces of the mesh to spawn instances. It is a balanced option with some shortcuts taken, without causing too noticeable patterns.
  • EMIT_FROM_FACES = 2 --- Uses faces of the mesh to spawn instances. This is the slowest option, but should produce no noticeable patterns.
  • EMIT_MODE_COUNT = 3

enum Distribution:

  • DISTRIBUTION_LINEAR = 0 --- Uniform distribution.
  • DISTRIBUTION_QUADRATIC = 1 --- Distribution with more small items, and fewer big ones.
  • DISTRIBUTION_CUBIC = 2 --- Distribution with even more small items, and even fewer big ones.
  • DISTRIBUTION_QUINTIC = 3
  • DISTRIBUTION_COUNT = 4

enum Dimension:

  • DIMENSION_2D = 0
  • DIMENSION_3D = 1
  • DIMENSION_COUNT = 2

Property Descriptions

float density = 0.1

Controls how many instances are generated. Might give different results depending on the type of emission chosen.

int emit_mode = 0

In which way instances are primarily emitted.

float max_height = 3.40282e+38

Instances will not be created above this height.

This also depends on the chosen VoxelInstancer.up_mode.

float max_scale = 1.0

Minimum scale instances will be randomized with.

float max_slope_degrees = 180.0

Instances will not spawn if the ground has a slope higher than this angle.

This also depends on the chosen VoxelInstancer.up_mode.

float min_height = 1.17549e-38

Instances will not be created below this height. This also depends on the chosen VoxelInstancer.up_mode.

float min_scale = 1.0

Maximum scale instances will be randomized with.

float min_slope_degrees = 0.0

Instances will not spawn if the ground has a slope lower than this angle.

This also depends on the chosen VoxelInstancer.up_mode.

Noise noise

Noise used to filter out spawned instances, so that they may spawn in patterns described by the noise.

int noise_dimension = 1

Which dimension should be used when evaluating VoxelInstanceGenerator.noise and VoxelInstanceGenerator.noise_graph.

VoxelGraphFunction noise_graph

Graph function used to filter out spawned instances, similar to VoxelInstanceGenerator.noise, but allows more custom noise computations.

The graph must have 2 inputs (X and Z) if VoxelInstanceGenerator.noise_dimension is 2D, and 3 inputs (X, Y and Z) if 3D. There must be one SDF output.

float noise_on_scale = 0.0

How much VoxelInstanceGenerator.noise also affects the scale of instances.

float offset_along_normal = 0.0

Offsets spawned instances along the normal of the ground.

The normal depends on VoxelInstancer.up_mode and is also affected by VoxelInstanceGenerator.vertical_alignment.

bool random_rotation = true

When enbabled, instances will be given a random rotation. If not, they will use a consistent rotation depending on the ground slope.

bool random_vertical_flip = false

When enabled, instances will randomly be flipped upside down. This can be useful with small rocks to create illusion of more variety.

int scale_distribution = 1

Sets how random scales are distributed.

float vertical_alignment = 1.0

Sets how much instances will align with the ground.

If 0, they will completely align with the ground.

If 1, they will completely align with whichever direction is considered "up".

This depends on VoxelInstancer.up_mode.

Generated on Apr 06, 2024