reckfellENGINE

VoxelInstanceGenerator

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

On this page
class VoxelInstanceGeneratorReckfellSharpInherits Resource

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

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.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

VoxelInstanceGeneratorConstructor
# VoxelInstanceGenerator
C#
public VoxelInstanceGenerator();

Properties31

DensityProperty
# Density
C#
public float Density { get; set; }

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

EmitModeProperty
# EmitMode
C#
public VoxelInstanceGenerator.EmitModeEnum EmitMode { get; set; }

In which way instances are primarily emitted.

JitterProperty
# Jitter
C#
public float Jitter { get; set; }

Controls randomness of spawning position when VoxelInstanceGenerator.EmitMode is set to VoxelInstanceGenerator.EmitModeEnum.OnePerTriangle.

MaxHeightProperty
# MaxHeight
C#
public float MaxHeight { get; set; }

Instances will not be created above this height. This also depends on the chosen VoxelInstancer.UpMode.

MaxHeightFalloffProperty
# MaxHeightFalloff
C#
public float MaxHeightFalloff { get; set; }

Distance over which density will fade, when below VoxelInstanceGenerator.MaxHeight.

MaxScaleProperty
# MaxScale
C#
public float MaxScale { get; set; }

Minimum scale instances will be randomized with.

MaxSlopeDegreesProperty
# MaxSlopeDegrees
C#
public float MaxSlopeDegrees { get; set; }

Instances will not spawn if the ground has a slope higher than this angle. This also depends on the chosen VoxelInstancer.UpMode.

MaxSlopeFalloffDegreesProperty
# MaxSlopeFalloffDegrees
C#
public float MaxSlopeFalloffDegrees { get; set; }

Angular distance over which density will fade, when below VoxelInstanceGenerator.MaxSlopeDegrees.

MinHeightProperty
# MinHeight
C#
public float MinHeight { get; set; }

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

MinHeightFalloffProperty
# MinHeightFalloff
C#
public float MinHeightFalloff { get; set; }

Distance over which density will fade, when above VoxelInstanceGenerator.MinHeight.

MinScaleProperty
# MinScale
C#
public float MinScale { get; set; }

Maximum scale instances will be randomized with.

MinSlopeDegreesProperty
# MinSlopeDegrees
C#
public float MinSlopeDegrees { get; set; }

Instances will not spawn if the ground has a slope lower than this angle. This also depends on the chosen VoxelInstancer.UpMode.

MinSlopeFalloffDegreesProperty
# MinSlopeFalloffDegrees
C#
public float MinSlopeFalloffDegrees { get; set; }

Angular distance over which density will fade, when above VoxelInstanceGenerator.MinSlopeDegrees.

NoiseProperty
# Noise
C#
public Noise Noise { get; set; }

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

NoiseDimensionProperty
# NoiseDimension
C#
public VoxelInstanceGenerator.Dimension NoiseDimension { get; set; }

Which dimension should be used when evaluating VoxelInstanceGenerator.Noise and VoxelInstanceGenerator.NoiseGraph.

NoiseFalloffProperty
# NoiseFalloff
C#
public float NoiseFalloff { get; set; }

Noise range over which density will fade. For example if falloff is 0.3, then density will fade when noise values are between 0 and 0.3.

NoiseGraphProperty
# NoiseGraph
C#
public VoxelGraphFunction NoiseGraph { get; set; }

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.NoiseDimension is 2D, and 3 inputs (X, Y and Z) if 3D. There must be one SDF output.

NoiseOnScaleProperty
# NoiseOnScale
C#
public float NoiseOnScale { get; set; }

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

NoiseThresholdProperty
# NoiseThreshold
C#
public float NoiseThreshold { get; set; }

Expands or shrink noise filtering. Higher values expand the areas where instances will spawn, lower values shrinks them.

OffsetAlongNormalProperty
# OffsetAlongNormal
C#
public float OffsetAlongNormal { get; set; }

Offsets spawned instances along the normal of the ground. The normal depends on VoxelInstancer.UpMode and is also affected by VoxelInstanceGenerator.VerticalAlignment.

RandomRotationProperty
# RandomRotation
C#
public bool RandomRotation { get; set; }

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

RandomVerticalFlipProperty
# RandomVerticalFlip
C#
public bool RandomVerticalFlip { get; set; }

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

ScaleDistributionProperty
# ScaleDistribution
C#
public VoxelInstanceGenerator.Distribution ScaleDistribution { get; set; }

Sets how random scales are distributed.

SnapToGeneratorSdfEnabledProperty
# SnapToGeneratorSdfEnabled
C#
public bool SnapToGeneratorSdfEnabled { get; set; }

Enables snapping to generator SDF. The generator's SDF values will be queried to move instances along their normal to be closerr to ground. Can help reduce the occurrence of "floating" or "buried" instances when moving close to them. This requires the terrain's generator to support series generation. Side-effects: instances might become floating or buried when seen from far away; spawning might become less even.

SnapToGeneratorSdfSampleCountProperty
# SnapToGeneratorSdfSampleCount
C#
public int SnapToGeneratorSdfSampleCount { get; set; }

How many samples per instance will be taken from the generator in order to approach the snapping position. More samples increases precision, but is more expensive.

SnapToGeneratorSdfSearchDistanceProperty
# SnapToGeneratorSdfSearchDistance
C#
public float SnapToGeneratorSdfSearchDistance { get; set; }

Distance up and down across which snapping will search for ground location.

TriangleAreaThresholdProperty
# TriangleAreaThreshold
C#
public float TriangleAreaThreshold { get; set; }

If set greater than zero, triangles of the ground with an area lower than this threshold will be ignored. Some meshing algorithms can often produce thin or small triangles that can affect distribution quality of spawned instances. If this happens, use this property to filter them out. Note: this property is relative to LOD0. The generator will scale it when spawning instances on meshes of different LOD index.

VerticalAlignmentProperty
# VerticalAlignment
C#
public float VerticalAlignment { get; set; }

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.UpMode.

VoxelTextureFilterArrayProperty
# VoxelTextureFilterArray
C#
public int[] VoxelTextureFilterArray { get; set; }

Specifies which voxel texture indices on top of which instances may spawn. This only works when VoxelInstanceGenerator.VoxelTextureFilterEnabled is enabled, and VoxelMesherTransvoxel is used with VoxelMesherTransvoxel.TexturingMode set to VoxelMesherTransvoxel.TexturingModeEnum.Mixel4S4 or VoxelMesherTransvoxel.TexturingModeEnum.SingleS4. Indices are currently limited between 0 and 31 included.

VoxelTextureFilterEnabledProperty
# VoxelTextureFilterEnabled
C#
public bool VoxelTextureFilterEnabled { get; set; }

When true, enables filtering of instances based on voxel texture indices. See VoxelInstanceGenerator.VoxelTextureFilterArray.

VoxelTextureFilterThresholdProperty
# VoxelTextureFilterThreshold
C#
public float VoxelTextureFilterThreshold { get; set; }

When VoxelInstanceGenerator.VoxelTextureFilterEnabled is active, controls how much of filtered texture has to be present for instances to spawn. The value must be betweem 0 and 1.

Methods65

GetDensityfloat
# GetDensity
C#
public float GetDensity();
Returns float
GetEmitModeVoxelInstanceGenerator.EmitModeEnum
# GetEmitMode
C#
public VoxelInstanceGenerator.EmitModeEnum GetEmitMode();
Returns VoxelInstanceGenerator.EmitModeEnum
GetJitterfloat
# GetJitter
C#
public float GetJitter();
Returns float
GetMaxHeightfloat
# GetMaxHeight
C#
public float GetMaxHeight();
Returns float
GetMaxHeightFallofffloat
# GetMaxHeightFalloff
C#
public float GetMaxHeightFalloff();
Returns float
GetMaxScalefloat
# GetMaxScale
C#
public float GetMaxScale();
Returns float
GetMaxSlopeDegreesfloat
# GetMaxSlopeDegrees
C#
public float GetMaxSlopeDegrees();
Returns float
GetMaxSlopeFalloffDegreesfloat
# GetMaxSlopeFalloffDegrees
C#
public float GetMaxSlopeFalloffDegrees();
Returns float
GetMinHeightfloat
# GetMinHeight
C#
public float GetMinHeight();
Returns float
GetMinHeightFallofffloat
# GetMinHeightFalloff
C#
public float GetMinHeightFalloff();
Returns float
GetMinScalefloat
# GetMinScale
C#
public float GetMinScale();
Returns float
GetMinSlopeDegreesfloat
# GetMinSlopeDegrees
C#
public float GetMinSlopeDegrees();
Returns float
GetMinSlopeFalloffDegreesfloat
# GetMinSlopeFalloffDegrees
C#
public float GetMinSlopeFalloffDegrees();
Returns float
GetNoiseNoise
# GetNoise
C#
public Noise GetNoise();
Returns Noise
GetNoiseDimensionVoxelInstanceGenerator.Dimension
# GetNoiseDimension
C#
public VoxelInstanceGenerator.Dimension GetNoiseDimension();
Returns VoxelInstanceGenerator.Dimension
GetNoiseFallofffloat
# GetNoiseFalloff
C#
public float GetNoiseFalloff();
Returns float
GetNoiseGraphVoxelGraphFunction
# GetNoiseGraph
C#
public VoxelGraphFunction GetNoiseGraph();
Returns VoxelGraphFunction
GetNoiseOnScalefloat
# GetNoiseOnScale
C#
public float GetNoiseOnScale();
Returns float
GetNoiseThresholdfloat
# GetNoiseThreshold
C#
public float GetNoiseThreshold();
Returns float
GetOffsetAlongNormalfloat
# GetOffsetAlongNormal
C#
public float GetOffsetAlongNormal();
Returns float
GetRandomRotationbool
# GetRandomRotation
C#
public bool GetRandomRotation();
Returns bool
GetRandomVerticalFlipbool
# GetRandomVerticalFlip
C#
public bool GetRandomVerticalFlip();
Returns bool
GetScaleDistributionVoxelInstanceGenerator.Distribution
# GetScaleDistribution
C#
public VoxelInstanceGenerator.Distribution GetScaleDistribution();
Returns VoxelInstanceGenerator.Distribution
GetSnapToGeneratorSdfEnabledbool
# GetSnapToGeneratorSdfEnabled
C#
public bool GetSnapToGeneratorSdfEnabled();
Returns bool
GetSnapToGeneratorSdfSampleCountint
# GetSnapToGeneratorSdfSampleCount
C#
public int GetSnapToGeneratorSdfSampleCount();
Returns int
GetSnapToGeneratorSdfSearchDistancefloat
# GetSnapToGeneratorSdfSearchDistance
C#
public float GetSnapToGeneratorSdfSearchDistance();
Returns float
GetTriangleAreaThresholdfloat
# GetTriangleAreaThreshold
C#
public float GetTriangleAreaThreshold();
Returns float
GetVerticalAlignmentfloat
# GetVerticalAlignment
C#
public float GetVerticalAlignment();
Returns float
GetVoxelTextureFilterArrayint[]
# GetVoxelTextureFilterArray
C#
public int[] GetVoxelTextureFilterArray();
Returns int[]
GetVoxelTextureFilterMaskuint
# GetVoxelTextureFilterMask
C#
public uint GetVoxelTextureFilterMask();
Returns uint
GetVoxelTextureFilterThresholdfloat
# GetVoxelTextureFilterThreshold
C#
public float GetVoxelTextureFilterThreshold();
Returns float
IsVoxelTextureFilterEnabledbool
# IsVoxelTextureFilterEnabled
C#
public bool IsVoxelTextureFilterEnabled();
Returns bool
SetDensityvoid
# SetDensity
C#
public void SetDensity(float density);
Parameters
NameTypeDefault
densityfloat—
SetEmitModevoid
# SetEmitMode
C#
public void SetEmitMode(VoxelInstanceGenerator.EmitModeEnum density);
Parameters
NameTypeDefault
densityVoxelInstanceGenerator.EmitModeEnum—
SetJittervoid
# SetJitter
C#
public void SetJitter(float jitter);
Parameters
NameTypeDefault
jitterfloat—
SetMaxHeightvoid
# SetMaxHeight
C#
public void SetMaxHeight(float height);
Parameters
NameTypeDefault
heightfloat—
SetMaxHeightFalloffvoid
# SetMaxHeightFalloff
C#
public void SetMaxHeightFalloff(float distance);
Parameters
NameTypeDefault
distancefloat—
SetMaxScalevoid
# SetMaxScale
C#
public void SetMaxScale(float maxScale);
Parameters
NameTypeDefault
maxScalefloat—
SetMaxSlopeDegreesvoid
# SetMaxSlopeDegrees
C#
public void SetMaxSlopeDegrees(float degrees);
Parameters
NameTypeDefault
degreesfloat—
SetMaxSlopeFalloffDegreesvoid
# SetMaxSlopeFalloffDegrees
C#
public void SetMaxSlopeFalloffDegrees(float degrees);
Parameters
NameTypeDefault
degreesfloat—
SetMinHeightvoid
# SetMinHeight
C#
public void SetMinHeight(float height);
Parameters
NameTypeDefault
heightfloat—
SetMinHeightFalloffvoid
# SetMinHeightFalloff
C#
public void SetMinHeightFalloff(float distance);
Parameters
NameTypeDefault
distancefloat—
SetMinScalevoid
# SetMinScale
C#
public void SetMinScale(float minScale);
Parameters
NameTypeDefault
minScalefloat—
SetMinSlopeDegreesvoid
# SetMinSlopeDegrees
C#
public void SetMinSlopeDegrees(float degrees);
Parameters
NameTypeDefault
degreesfloat—
SetMinSlopeFalloffDegreesvoid
# SetMinSlopeFalloffDegrees
C#
public void SetMinSlopeFalloffDegrees(float degrees);
Parameters
NameTypeDefault
degreesfloat—
SetNoisevoid
# SetNoise
C#
public void SetNoise(Noise noise);
Parameters
NameTypeDefault
noiseNoise—
SetNoiseDimensionvoid
# SetNoiseDimension
C#
public void SetNoiseDimension(VoxelInstanceGenerator.Dimension dim);
Parameters
NameTypeDefault
dimVoxelInstanceGenerator.Dimension—
SetNoiseFalloffvoid
# SetNoiseFalloff
C#
public void SetNoiseFalloff(float falloff);
Parameters
NameTypeDefault
fallofffloat—
SetNoiseGraphvoid
# SetNoiseGraph
C#
public void SetNoiseGraph(VoxelGraphFunction graph);
Parameters
NameTypeDefault
graphVoxelGraphFunction—
SetNoiseOnScalevoid
# SetNoiseOnScale
C#
public void SetNoiseOnScale(float amount);
Parameters
NameTypeDefault
amountfloat—
SetNoiseThresholdvoid
# SetNoiseThreshold
C#
public void SetNoiseThreshold(float threshold);
Parameters
NameTypeDefault
thresholdfloat—
SetOffsetAlongNormalvoid
# SetOffsetAlongNormal
C#
public void SetOffsetAlongNormal(float offset);
Parameters
NameTypeDefault
offsetfloat—
SetRandomRotationvoid
# SetRandomRotation
C#
public void SetRandomRotation(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetRandomVerticalFlipvoid
# SetRandomVerticalFlip
C#
public void SetRandomVerticalFlip(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetScaleDistributionvoid
# SetScaleDistribution
C#
public void SetScaleDistribution(VoxelInstanceGenerator.Distribution distribution);
Parameters
NameTypeDefault
distributionVoxelInstanceGenerator.Distribution—
SetSnapToGeneratorSdfEnabledvoid
# SetSnapToGeneratorSdfEnabled
C#
public void SetSnapToGeneratorSdfEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetSnapToGeneratorSdfSampleCountvoid
# SetSnapToGeneratorSdfSampleCount
C#
public void SetSnapToGeneratorSdfSampleCount(int enabled);
Parameters
NameTypeDefault
enabledint—
SetSnapToGeneratorSdfSearchDistancevoid
# SetSnapToGeneratorSdfSearchDistance
C#
public void SetSnapToGeneratorSdfSearchDistance(float d);
Parameters
NameTypeDefault
dfloat—
SetTriangleAreaThresholdvoid
# SetTriangleAreaThreshold
C#
public void SetTriangleAreaThreshold(float threshold);
Parameters
NameTypeDefault
thresholdfloat—
SetVerticalAlignmentvoid
# SetVerticalAlignment
C#
public void SetVerticalAlignment(float amount);
Parameters
NameTypeDefault
amountfloat—
SetVoxelTextureFilterArray2 overloads
# SetVoxelTextureFilterArray · 1/2
C#
public void SetVoxelTextureFilterArray(int[] textureIndices);
Parameters
NameTypeDefault
textureIndicesint[]—
# SetVoxelTextureFilterArray · 2/2
C#
public void SetVoxelTextureFilterArray(ReadOnlySpan<int> textureIndices);
Parameters
NameTypeDefault
textureIndicesReadOnlySpan<int>—
SetVoxelTextureFilterEnabledvoid
# SetVoxelTextureFilterEnabled
C#
public void SetVoxelTextureFilterEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetVoxelTextureFilterMaskvoid
# SetVoxelTextureFilterMask
C#
public void SetVoxelTextureFilterMask(uint mask);
Parameters
NameTypeDefault
maskuint—
SetVoxelTextureFilterThresholdvoid
# SetVoxelTextureFilterThreshold
C#
public void SetVoxelTextureFilterThreshold(float threshold);
Parameters
NameTypeDefault
thresholdfloat—

VoxelInstanceGenerator.Dimension

VoxelInstanceGenerator.Distribution

ValueDescription
Count = 4
Cubic = 2

Distribution with even more small items, and even fewer big ones.

Linear = 0

Uniform distribution.

Quadratic = 1

Distribution with more small items, and fewer big ones.

Quintic = 3

VoxelInstanceGenerator.EmitModeEnum

ValueDescription
FromFaces = 2

Uses faces of the mesh to spawn instances. This is the slowest option, but should produce no noticeable patterns.

FromFacesFast = 1

Uses faces of the mesh to spawn instances. It is a balanced option with some shortcuts taken, without causing too noticeable patterns.

FromVertices = 0

Use vertices of the mesh to spawn instances. This is the fasted option, but can produce noticeable patterns.

ModeCount = 4
OnePerTriangle = 3

Uses faces of the mesh to spawn instances (where faces are triangles). Only one instance is spawned per triangle. By default, it spawns in the middle of triangles. Randomness can be added to this position with VoxelInstanceGenerator.Jitter.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.