Skip to content

Latest commit

 

History

History
1685 lines (1242 loc) · 39.4 KB

File metadata and controls

1685 lines (1242 loc) · 39.4 KB

Density Functions

Source: Decompiled from HytaleServer.jar (pre-release 2026.02.05-9ce2783f7)

Density functions are the computational graph core of Hytale's V2 world generation system. There are 68 registered density function types in AssetManager.java, each representing a node in a directed acyclic graph (DAG). Every node takes zero or more inputs and produces a single double output value. These graphs define terrain shape, material selection, prop placement thresholds, and more.

At generation time, the graph is evaluated per-position: each density function receives a Density.Context containing the current sampling coordinates and related state, and returns a scalar value. Complex terrain is built by composing simple nodes -- noise generators feed into math operations, which feed into clamps and curves, which ultimately produce the terrain density field.


Common Fields

All density function assets inherit shared base fields from DensityAsset.ABSTRACT_CODEC:

Field Type Required Default Description
Inputs DensityAsset[] No [] Child density inputs -- the upstream nodes in the graph
Skip boolean No false If true, the function is disabled and returns a constant 0.0
ExportAs string No null Name to register this density under for the Export/Import reuse system

Every concrete density type adds its own fields on top of these three. The Inputs array ordering matters -- many types reference inputs by index (e.g., Mix uses inputs[0] as a, inputs[1] as b, inputs[2] as factor).


Density.Context

The context object passed to all density functions at evaluation time:

Field Type Description
position Vector3d Current sampling position in world space
densityAnchor Vector3d Anchor point for relative/anchored calculations
positionsAnchor Vector3d Positions-based anchor (used by Positions* types)
switchState int Current switch state hash for conditional branching
distanceFromCellWall double Distance from the nearest cell wall boundary
terrainDensityProvider TerrainDensityProvider Provider for querying terrain density at arbitrary positions
distanceToBiomeEdge int Distance (in blocks) to the nearest biome edge

Coordinate transform nodes (Scale, Slider, Rotator, etc.) modify the position in the context before passing it to their child input, effectively transforming the coordinate space of the sub-graph.


Type Reference

Noise Generators

Four noise function types that sample procedural noise fields. These are leaf nodes with no density inputs.

SimplexNoise2D

2D simplex noise sampled at (x, z). Ignores Y coordinate.

Field Type Default Description
Lacunarity double 1.0 Frequency multiplier between octaves
Persistence double 1.0 Amplitude multiplier between octaves
Scale double 1.0 Base frequency scale
Octaves int 1 Number of noise octaves
Seed string "A" Seed string for deterministic generation

Inputs: 0

{
  "Type": "SimplexNoise2D",
  "Seed": "terrain_height",
  "Scale": 0.003,
  "Octaves": 4,
  "Lacunarity": 2.0,
  "Persistence": 0.5
}

SimplexNoise3D

3D simplex noise sampled at (x, y, z) with independent XZ and Y scaling.

Field Type Default Description
Lacunarity double 1.0 Frequency multiplier between octaves
Persistence double 1.0 Amplitude multiplier between octaves
ScaleXZ double 1.0 Horizontal frequency scale
ScaleY double 1.0 Vertical frequency scale
Octaves int 1 Number of noise octaves
Seed string "A" Seed string for deterministic generation

Inputs: 0

{
  "Type": "SimplexNoise3D",
  "Seed": "caves_3d",
  "ScaleXZ": 0.02,
  "ScaleY": 0.04,
  "Octaves": 3,
  "Lacunarity": 2.0,
  "Persistence": 0.45
}

CellNoise2D

2D cellular/Voronoi noise. Returns values based on the selected ReturnType (distance to cell center, cell value, etc.).

Field Type Default Description
ScaleX double 1.0 Horizontal X frequency scale
ScaleZ double 1.0 Horizontal Z frequency scale
Jitter double 0.5 Cell point randomization amount
Octaves int 1 Number of noise octaves
Seed string "A" Seed string for deterministic generation
ReturnType ReturnTypeAsset Determines what value the cell noise returns (see ReturnType Assets)

Inputs: 0

{
  "Type": "CellNoise2D",
  "Seed": "biome_regions",
  "ScaleX": 0.005,
  "ScaleZ": 0.005,
  "Jitter": 0.45,
  "Octaves": 1,
  "ReturnType": {
    "Type": "Distance"
  }
}

CellNoise3D

3D cellular/Voronoi noise with independent X, Y, Z scaling.

Field Type Default Description
ScaleX double 1.0 X frequency scale
ScaleY double 1.0 Y frequency scale
ScaleZ double 1.0 Z frequency scale
Jitter double 0.5 Cell point randomization amount
Octaves int 1 Number of noise octaves
Seed string "A" Seed string for deterministic generation
ReturnType ReturnTypeAsset Determines what value the cell noise returns (see ReturnType Assets)

Inputs: 0

{
  "Type": "CellNoise3D",
  "Seed": "ore_pockets",
  "ScaleX": 0.1,
  "ScaleY": 0.15,
  "ScaleZ": 0.1,
  "Jitter": 0.5,
  "Octaves": 1,
  "ReturnType": {
    "Type": "CellValue"
  }
}

Math Operations

Nine types for arithmetic operations on density values.

Constant

Returns a fixed value. The simplest density node.

Field Type Default Description
Value double required The constant value to return

Inputs: 0

{
  "Type": "Constant",
  "Value": 64.0
}

Sum

Adds all input values together. Accepts a variable number of inputs.

Inputs: Variable (sums all)

{
  "Type": "Sum",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "base", "Scale": 0.005 },
    { "Type": "Constant", "Value": 100.0 }
  ]
}

Multiplier

Multiplies all input values together. Accepts a variable number of inputs.

Inputs: Variable (multiplies all)

{
  "Type": "Multiplier",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "amp", "Scale": 0.001 },
    { "Type": "Constant", "Value": 50.0 }
  ]
}

Abs

Returns the absolute value of the input.

Inputs: 1

{
  "Type": "Abs",
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "ridges", "ScaleXZ": 0.01, "ScaleY": 0.02 }
  ]
}

Inverter

Negates the input value (multiplies by -1).

Inputs: 1

{
  "Type": "Inverter",
  "Inputs": [
    { "Type": "YValue" }
  ]
}

Sqrt

Returns the square root of the input value.

Inputs: 1

{
  "Type": "Sqrt",
  "Inputs": [
    { "Type": "Distance" }
  ]
}

Pow

Raises the input to the specified exponent.

Field Type Default Description
Exponent double 1.0 The power to raise the input to

Inputs: 1

{
  "Type": "Pow",
  "Exponent": 2.0,
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "terrain", "Scale": 0.01 }
  ]
}

OffsetConstant

Legacy constant representing an offset value. Returns a fixed constant. Retained for backward compatibility.

Inputs: 0

{
  "Type": "OffsetConstant"
}

AmplitudeConstant

Legacy constant representing an amplitude value. Returns a fixed constant. Retained for backward compatibility.

Inputs: 0

{
  "Type": "AmplitudeConstant"
}

Clamping & Range

Ten types for constraining and selecting value ranges.

Clamp

Clamps the input value between WallA and WallB.

Field Type Default Description
WallA double Lower bound
WallB double Upper bound

Inputs: 1

{
  "Type": "Clamp",
  "WallA": 0.0,
  "WallB": 1.0,
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "mask", "Scale": 0.01 }
  ]
}

SmoothClamp

Smooth (differentiable) clamping with a configurable smoothing range at the boundaries.

Field Type Default Description
WallA double -1.0 Lower bound
WallB double 1.0 Upper bound
Range double 0.01 Smoothing transition range at the clamp boundaries

Inputs: 1

{
  "Type": "SmoothClamp",
  "WallA": -1.0,
  "WallB": 1.0,
  "Range": 0.1,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "smooth_terrain", "ScaleXZ": 0.01, "ScaleY": 0.02 }
  ]
}

Floor

Applies a hard lower limit. Values below Limit are set to Limit.

Field Type Default Description
Limit double 0.0 Minimum allowed value

Inputs: 1

{
  "Type": "Floor",
  "Limit": 0.0,
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "height", "Scale": 0.003 }
  ]
}

SmoothFloor

Smooth lower limit with a gradual transition zone.

Field Type Default Description
Limit double Minimum allowed value
SmoothRange double 1.0 Transition distance below the limit

Inputs: 1

{
  "Type": "SmoothFloor",
  "Limit": 0.0,
  "SmoothRange": 2.0,
  "Inputs": [
    { "Type": "Sum", "Inputs": [] }
  ]
}

Ceiling

Applies a hard upper limit. Values above Limit are set to Limit.

Field Type Default Description
Limit double Maximum allowed value

Inputs: 1

{
  "Type": "Ceiling",
  "Limit": 200.0,
  "Inputs": [
    { "Type": "YValue" }
  ]
}

SmoothCeiling

Smooth upper limit with a gradual transition zone.

Field Type Default Description
Limit double Maximum allowed value
SmoothRange double 1.0 Transition distance above the limit

Inputs: 1

{
  "Type": "SmoothCeiling",
  "Limit": 256.0,
  "SmoothRange": 4.0,
  "Inputs": [
    { "Type": "YValue" }
  ]
}

Min

Returns the minimum value from all inputs. Accepts a variable number of inputs.

Inputs: Variable

{
  "Type": "Min",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "a", "Scale": 0.01 },
    { "Type": "SimplexNoise2D", "Seed": "b", "Scale": 0.02 }
  ]
}

SmoothMin

Smooth minimum of two inputs with a configurable blending range (polynomial smooth min).

Field Type Default Description
Range double 1.0 Blending distance between the two values

Inputs: 2

{
  "Type": "SmoothMin",
  "Range": 4.0,
  "Inputs": [
    { "Type": "Distance" },
    { "Type": "Constant", "Value": 10.0 }
  ]
}

Max

Returns the maximum value from all inputs. Accepts a variable number of inputs.

Inputs: Variable

{
  "Type": "Max",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "a", "Scale": 0.01 },
    { "Type": "Constant", "Value": 0.0 }
  ]
}

SmoothMax

Smooth maximum of two inputs with a configurable blending range.

Field Type Default Description
Range double 1.0 Blending distance between the two values

Inputs: 2

{
  "Type": "SmoothMax",
  "Range": 2.0,
  "Inputs": [
    { "Type": "Terrain" },
    { "Type": "Constant", "Value": -5.0 }
  ]
}

Mapping & Remapping

Three types for transforming value ranges.

Normalizer

Linearly remaps a value from one range to another.

Field Type Default Description
FromMin double 0.0 Source range minimum
FromMax double 1.0 Source range maximum
ToMin double 0.0 Target range minimum
ToMax double 1.0 Target range maximum

Inputs: 1

{
  "Type": "Normalizer",
  "FromMin": -1.0,
  "FromMax": 1.0,
  "ToMin": 0.0,
  "ToMax": 100.0,
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "height", "Scale": 0.005 }
  ]
}

CurveMapper

Remaps the input value through an arbitrary curve defined by a CurveAsset.

Field Type Default Description
Curve CurveAsset The curve used to remap the input value

Inputs: 1

{
  "Type": "CurveMapper",
  "Curve": {
    "Type": "SimpleCurve",
    "Points": [
      [0.0, 0.0],
      [0.5, 0.8],
      [1.0, 1.0]
    ]
  },
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "contour", "Scale": 0.003 }
  ]
}

Offset / Amplitude

Legacy remapping types. Apply a Y-dependent function for offset or amplitude modification.

Field Type Default Description
FunctionForY NodeFunctionYOutAsset Y-axis dependent function applied to the input

Inputs: 1 each

{
  "Type": "Offset",
  "FunctionForY": { "Type": "Linear", "Slope": 0.5, "Intercept": 64.0 },
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "base", "Scale": 0.005 }
  ]
}

Mixing & Blending

Two types for blending between density values.

Mix

Linear interpolation (lerp) between two values. Input 0 is a, input 1 is b, input 2 is the factor (0.0 returns a, 1.0 returns b).

Inputs: 3 (a, b, factor)

{
  "Type": "Mix",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "plains", "Scale": 0.003 },
    { "Type": "SimplexNoise2D", "Seed": "mountains", "Scale": 0.001 },
    { "Type": "SimplexNoise2D", "Seed": "blend", "Scale": 0.0005 }
  ]
}

MultiMix

Piecewise linear blending across multiple inputs using keyed breakpoints. Each key defines a threshold value; the density smoothly transitions between adjacent inputs as the first input crosses key boundaries.

Field Type Default Description
Keys KeyAsset[] Array of key breakpoints defining the piecewise transitions

Inputs: Variable (one per segment)

{
  "Type": "MultiMix",
  "Keys": [
    { "Value": 0.0 },
    { "Value": 0.33 },
    { "Value": 0.66 },
    { "Value": 1.0 }
  ],
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "selector", "Scale": 0.001 },
    { "Type": "Constant", "Value": 60.0 },
    { "Type": "Constant", "Value": 80.0 },
    { "Type": "Constant", "Value": 120.0 }
  ]
}

Coordinate Transforms

Seven types for transforming the coordinate space before evaluating child inputs.

Scale

Scales the sampling coordinates by independent per-axis factors.

Field Type Default Description
ScaleX double 1.0 X-axis scale factor
ScaleY double 1.0 Y-axis scale factor
ScaleZ double 1.0 Z-axis scale factor

Inputs: 1

{
  "Type": "Scale",
  "ScaleX": 2.0,
  "ScaleY": 0.5,
  "ScaleZ": 2.0,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "detail", "ScaleXZ": 0.1, "ScaleY": 0.1 }
  ]
}

Slider

Translates (offsets) the sampling coordinates by a fixed amount per axis.

Field Type Default Description
SlideX double 0.0 X-axis offset
SlideY double 0.0 Y-axis offset
SlideZ double 0.0 Z-axis offset

Inputs: 1

{
  "Type": "Slider",
  "SlideY": -64.0,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "shifted", "ScaleXZ": 0.02, "ScaleY": 0.02 }
  ]
}

Rotator

Rotates the coordinate space by redefining the Y axis and applying a spin angle.

Field Type Default Description
NewYAxis Vector3d The new Y-axis direction vector
SpinAngle double Rotation angle (radians) around the new Y axis

Inputs: 1

{
  "Type": "Rotator",
  "NewYAxis": [0.0, 1.0, 0.0],
  "SpinAngle": 0.785,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "rotated", "ScaleXZ": 0.01, "ScaleY": 0.01 }
  ]
}

Anchor

Switches the sampling position to use the density anchor point from the context, enabling relative-to-anchor calculations.

Field Type Default Description
Reversed boolean false If true, inverts the anchor direction

Inputs: 1

{
  "Type": "Anchor",
  "Reversed": false,
  "Inputs": [
    { "Type": "Distance" }
  ]
}

XOverride

Overrides the X coordinate of the sampling position with a fixed value.

Field Type Default Description
Value double The fixed X coordinate value

Inputs: 1

{
  "Type": "XOverride",
  "Value": 0.0,
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "stripe", "Scale": 0.01 }
  ]
}

YOverride

Overrides the Y coordinate of the sampling position with a fixed value.

Field Type Default Description
Value double The fixed Y coordinate value

Inputs: 1

{
  "Type": "YOverride",
  "Value": 64.0,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "flat_sample", "ScaleXZ": 0.01, "ScaleY": 0.01 }
  ]
}

ZOverride

Overrides the Z coordinate of the sampling position with a fixed value.

Field Type Default Description
Value double The fixed Z coordinate value

Inputs: 1

{
  "Type": "ZOverride",
  "Value": 0.0,
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "column", "Scale": 0.01 }
  ]
}

Warping

Three types for spatially distorting the coordinate space of a child density function.

GradientWarp

Warps the sampling position along the gradient of a secondary density field. Displaces coordinates in the direction of steepest change, creating organic distortions.

Field Type Default Description
SampleRange double 1.0 Distance used to compute the gradient via finite differences
WarpFactor double 1.0 Strength multiplier for the warp displacement
2D boolean If true, performs 2D gradient warp (XZ only)
YFor2D double Fixed Y value used when 2D is true

Inputs: 2 (input 0 = density to warp, input 1 = gradient source field)

{
  "Type": "GradientWarp",
  "SampleRange": 2.0,
  "WarpFactor": 8.0,
  "2D": false,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "base", "ScaleXZ": 0.01, "ScaleY": 0.01 },
    { "Type": "SimplexNoise3D", "Seed": "warp_field", "ScaleXZ": 0.005, "ScaleY": 0.005 }
  ]
}

FastGradientWarp

A performance-optimized gradient warp using built-in noise generation. Avoids the need for a separate gradient source input.

Field Type Default Description
WarpScale float 1.0 Scale of the warp noise field
WarpOctaves int 1 Number of noise octaves for the warp field
WarpLacunarity float 2.0 Lacunarity of the warp noise
WarpPersistence float 0.5 Persistence of the warp noise
WarpFactor float 1.0 Strength multiplier for the displacement
Seed string "A" Seed string for the internal warp noise

Inputs: 1

{
  "Type": "FastGradientWarp",
  "WarpScale": 0.01,
  "WarpOctaves": 2,
  "WarpFactor": 5.0,
  "Seed": "fast_warp",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "terrain", "Scale": 0.005 }
  ]
}

VectorWarp

Warps the sampling position by a fixed direction vector scaled by a secondary density field.

Field Type Default Description
WarpFactor double 1.0 Strength multiplier for the displacement
WarpVector Vector3d Direction vector of the warp displacement

Inputs: 2 (input 0 = density to warp, input 1 = warp magnitude source)

{
  "Type": "VectorWarp",
  "WarpFactor": 3.0,
  "WarpVector": [1.0, 0.0, 0.0],
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "base", "ScaleXZ": 0.02, "ScaleY": 0.02 },
    { "Type": "SimplexNoise2D", "Seed": "warp_amount", "Scale": 0.005 }
  ]
}

Shape Primitives

Nine types that generate density fields based on geometric distance calculations. These are leaf nodes (no density inputs) that compute distance from the origin or anchor point to define shapes.

Distance

Spherical distance from the origin (or anchor). Returns a value based on the Euclidean distance, remapped through an optional curve.

Field Type Default Description
Curve CurveAsset Curve to remap the raw distance value

Inputs: 0

{
  "Type": "Distance",
  "Curve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [10.0, 0.0]]
  }
}

Cube

Cubic distance from the origin. Uses the maximum absolute coordinate component (Chebyshev distance) to define a cube shape.

Field Type Default Description
Curve CurveAsset Curve to remap the raw distance value

Inputs: 0

{
  "Type": "Cube",
  "Curve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [5.0, 0.0]]
  }
}

Ellipsoid

Ellipsoidal distance with per-axis scaling and optional rotation.

Field Type Default Description
Curve CurveAsset Curve to remap the raw distance value
Scale Vector3d [1, 1, 1] Per-axis scale factors defining the ellipsoid radii
NewYAxis Vector3d [0, 1, 0] Reorientation of the Y axis
Spin double Rotation angle around the new Y axis

Inputs: 0

{
  "Type": "Ellipsoid",
  "Scale": [10.0, 5.0, 10.0],
  "NewYAxis": [0.0, 1.0, 0.0],
  "Spin": 0.0,
  "Curve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [1.0, 0.0]]
  }
}

Cuboid

Oriented box shape with per-axis scaling and rotation.

Field Type Default Description
Curve CurveAsset Curve to remap the raw distance value
Scale Vector3d [1, 1, 1] Per-axis scale factors defining the cuboid dimensions
NewYAxis Vector3d [0, 1, 0] Reorientation of the Y axis
Spin double Rotation angle around the new Y axis

Inputs: 0

{
  "Type": "Cuboid",
  "Scale": [8.0, 4.0, 8.0],
  "NewYAxis": [0.0, 1.0, 0.0],
  "Spin": 0.5,
  "Curve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [1.0, 0.0]]
  }
}

Cylinder

Cylindrical shape with separate radial and axial curves for independent falloff control.

Field Type Default Description
RadialCurve CurveAsset Curve controlling radial (cross-section) falloff
AxialCurve CurveAsset Curve controlling axial (along-length) falloff
NewYAxis Vector3d [0, 1, 0] Orientation axis of the cylinder
Spin double Rotation angle around the cylinder axis

Inputs: 0

{
  "Type": "Cylinder",
  "NewYAxis": [0.0, 1.0, 0.0],
  "Spin": 0.0,
  "RadialCurve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [5.0, 0.0]]
  },
  "AxialCurve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [10.0, 0.0]]
  }
}

Plane

Density based on signed distance to an infinite plane.

Field Type Default Description
Curve CurveAsset Curve to remap the signed distance
IsAnchored boolean If true, the plane passes through the density anchor
PlaneNormal Vector3d [0, 1, 0] Normal vector defining the plane orientation

Inputs: 0

{
  "Type": "Plane",
  "IsAnchored": true,
  "PlaneNormal": [0.0, 1.0, 0.0],
  "Curve": {
    "Type": "SimpleCurve",
    "Points": [[-10.0, 1.0], [0.0, 0.5], [10.0, 0.0]]
  }
}

Axis

Density based on distance from an infinite line (axis).

Field Type Default Description
Curve CurveAsset Curve to remap the distance
IsAnchored boolean If true, the axis passes through the density anchor
Axis Vector3d [0, 1, 0] Direction vector of the axis

Inputs: 0

{
  "Type": "Axis",
  "IsAnchored": true,
  "Axis": [0.0, 1.0, 0.0],
  "Curve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [8.0, 0.0]]
  }
}

Shell

Generates a shell shape based on angle and distance curves, useful for creating shell-like or petal-like forms.

Field Type Default Description
Axis Vector3d Central axis of the shell
Mirror boolean If true, mirrors the shape across the axis
AngleCurve CurveAsset Curve defining the angular profile
DistanceCurve CurveAsset Curve defining the distance-based falloff

Inputs: 0

{
  "Type": "Shell",
  "Axis": [0.0, 1.0, 0.0],
  "Mirror": true,
  "AngleCurve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [3.14, 0.0]]
  },
  "DistanceCurve": {
    "Type": "SimpleCurve",
    "Points": [[0.0, 1.0], [5.0, 0.0]]
  }
}

Angle

Returns the angle between a reference vector and either a vector provider output or a fixed direction.

Field Type Default Description
VectorProvider VectorProviderAsset Provides the reference vector
Vector Vector3d Fixed comparison vector
IsAxis boolean If true, computes the angle relative to an axis rather than a direction

Inputs: 0

{
  "Type": "Angle",
  "Vector": [0.0, 1.0, 0.0],
  "IsAxis": false,
  "VectorProvider": {
    "Type": "Constant",
    "Value": [1.0, 0.0, 0.0]
  }
}

Coordinate Accessors

Three types that directly return one of the current sampling coordinates.

XValue

Returns the X coordinate of the current sampling position.

Inputs: 0

{
  "Type": "XValue"
}

YValue

Returns the Y coordinate of the current sampling position.

Inputs: 0

{
  "Type": "YValue"
}

ZValue

Returns the Z coordinate of the current sampling position.

Inputs: 0

{
  "Type": "ZValue"
}

Context Accessors

Four types that read values from the Density.Context rather than computing them.

Terrain

Returns the terrain density at the current sampling position by querying the context's terrainDensityProvider.

Inputs: 0

{
  "Type": "Terrain"
}

BaseHeight

Returns the base terrain height for the current column, optionally as a distance from the sampling position.

Field Type Default Description
BaseHeightName string Name identifier for the base height source
Distance boolean If true, returns distance from sampling Y to the base height; if false, returns the raw height value

Inputs: 0

{
  "Type": "BaseHeight",
  "BaseHeightName": "surface",
  "Distance": true
}

CellWallDistance

Returns the distanceFromCellWall value from the context. Useful for creating features that respond to cell/Voronoi boundaries.

Inputs: 0

{
  "Type": "CellWallDistance"
}

DistanceToBiomeEdge

Returns the distanceToBiomeEdge value from the context. Useful for biome transition blending.

Inputs: 0

{
  "Type": "DistanceToBiomeEdge"
}

Gradient

One type for computing directional gradients of density fields.

Gradient

Computes the directional derivative (gradient) of the input density along a specified axis direction using finite differences.

Field Type Default Description
Axis Vector3d [0, 1, 0] Direction along which to compute the gradient
SampleRange double 1.0 Distance between the two sample points for finite differences

Inputs: 1

{
  "Type": "Gradient",
  "Axis": [0.0, 1.0, 0.0],
  "SampleRange": 1.0,
  "Inputs": [
    { "Type": "Terrain" }
  ]
}

Caching

Three types for caching density evaluation results to avoid redundant computation.

Cache

Caches the most recently evaluated positions and their results. Provides a simple LRU-style cache.

Field Type Default Description
Capacity int 3 Number of cached position/result pairs

Inputs: 1

{
  "Type": "Cache",
  "Capacity": 8,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "expensive", "ScaleXZ": 0.001, "ScaleY": 0.001, "Octaves": 6 }
  ]
}

Cache2D

Deprecated. 2D position cache that only considers the (x, z) coordinates. Retained for backward compatibility.

Inputs: 1

{
  "Type": "Cache2D",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "height_cache", "Scale": 0.005 }
  ]
}

YSampled

Vertical interpolation optimization. Samples the input at regular Y intervals and interpolates between them, significantly reducing evaluation cost for densities that vary smoothly along the Y axis.

Field Type Default Description
SampleDistance double 4.0 Vertical distance between sample points
SampleOffset double 0.0 Vertical offset for the sampling grid

Inputs: 1

{
  "Type": "YSampled",
  "SampleDistance": 4.0,
  "SampleOffset": 0.0,
  "Inputs": [
    { "Type": "SimplexNoise3D", "Seed": "terrain_3d", "ScaleXZ": 0.01, "ScaleY": 0.02 }
  ]
}

Conditional

Two types for branching the density graph based on runtime state.

Switch

Selects one of several child density functions based on the current switchState in the context. Each case maps a state hash to an input index.

Field Type Default Description
SwitchCases SwitchCaseAsset[] Array of case definitions mapping state hashes to input indices

Inputs: Variable (one per case)

{
  "Type": "Switch",
  "SwitchCases": [
    { "State": "plains", "InputIndex": 0 },
    { "State": "mountains", "InputIndex": 1 },
    { "State": "ocean", "InputIndex": 2 }
  ],
  "Inputs": [
    { "Type": "Constant", "Value": 64.0 },
    { "Type": "Constant", "Value": 128.0 },
    { "Type": "Constant", "Value": 32.0 }
  ]
}

SwitchState

Sets the switchState in the context before evaluating the child input. Used to configure downstream Switch nodes.

Field Type Default Description
SwitchState string State string that is hashed and set as the current switch state

Inputs: 1

{
  "Type": "SwitchState",
  "SwitchState": "mountains",
  "Inputs": [
    { "Type": "Switch", "SwitchCases": [] }
  ]
}

Positions-Based

Four types that operate using the positions-based anchor and context for cell-noise-driven generation systems.

PositionsCellNoise

Generates density based on cell noise position data. Integrates with the positions-based pipeline where candidate positions are generated from cell noise patterns.

Inputs: Variable

{
  "Type": "PositionsCellNoise"
}

Positions3D

3D position-based density evaluation. Samples density at positions defined by the positions anchor system.

Inputs: Variable

{
  "Type": "Positions3D"
}

PositionsPinch

Applies a spatial pinch effect, compressing or expanding space toward/away from a point. Used for creating organic deformations in position-based generation.

Inputs: Variable

{
  "Type": "PositionsPinch"
}

PositionsTwist

Applies a spatial twist effect, rotating space progressively along an axis. Used for creating spiraling or twisted formations.

Inputs: Variable

{
  "Type": "PositionsTwist"
}

Import / Export / Pipeline

Three types for composing and reusing density graphs.

Exported

Wraps a density function for export. The wrapped density is registered under its ExportAs name and cached with SingleInstance optimization -- meaning the density is built once and shared across all references.

Inputs: 1

{
  "Type": "Exported",
  "ExportAs": "shared_terrain_noise",
  "Inputs": [
    {
      "Type": "SimplexNoise2D",
      "Seed": "terrain",
      "Scale": 0.003,
      "Octaves": 4,
      "Lacunarity": 2.0,
      "Persistence": 0.5
    }
  ]
}

Imported

References a previously exported density function by name. At build time, the imported density resolves to the SingleInstance-cached version of the exported density.

Field Type Default Description
Name string Name of the exported density to import

Inputs: 0

{
  "Type": "Imported",
  "Name": "shared_terrain_noise"
}

Pipeline

A complex composition node that chains density functions in a sequential pipeline. Each stage of the pipeline can modify or build upon the previous stage's output.

Inputs: Variable

{
  "Type": "Pipeline",
  "Inputs": [
    { "Type": "SimplexNoise2D", "Seed": "base_height", "Scale": 0.003 },
    { "Type": "Normalizer", "FromMin": -1.0, "FromMax": 1.0, "ToMin": 40.0, "ToMax": 120.0 },
    { "Type": "Cache", "Capacity": 4 }
  ]
}

Export / Import System

Any density function can set the ExportAs field (from DensityAsset.ABSTRACT_CODEC) to register itself under a name string. Other density functions anywhere in the graph can then use the Imported type with that name to reference the same density.

The ExportedDensityAsset class adds SingleInstance caching optimization: the density is built exactly once during the build phase and the same runtime instance is shared across all import references. This is critical for performance when the same expensive noise function or density sub-graph is used by multiple biomes or terrain layers.

{
  "Type": "Sum",
  "Inputs": [
    {
      "Type": "SimplexNoise2D",
      "Seed": "continent",
      "Scale": 0.0005,
      "Octaves": 6,
      "ExportAs": "continent_noise"
    },
    {
      "Type": "Multiplier",
      "Inputs": [
        { "Type": "Imported", "Name": "continent_noise" },
        { "Type": "Constant", "Value": 80.0 }
      ]
    }
  ]
}

ReturnType Assets

Cell noise functions (CellNoise2D, CellNoise3D) use a ReturnType field to select what value the noise returns. There are 10 registered return type assets:

Type String Description
CellValue Returns the random value assigned to the nearest cell
Curve Returns a curve-remapped value
Distance Returns the distance to the nearest cell point
Distance2 Returns the distance to the second-nearest cell point
Distance2Add Returns Distance + Distance2
Distance2Sub Returns Distance2 - Distance (creates cell edge patterns)
Distance2Mul Returns Distance * Distance2
Distance2Div Returns Distance / Distance2
Imported References an exported return type
Density Uses a density function to compute the return value
{
  "Type": "CellNoise2D",
  "Seed": "edge_detect",
  "ScaleX": 0.01,
  "ScaleZ": 0.01,
  "ReturnType": {
    "Type": "Distance2Sub"
  }
}

DistanceFunction Assets

Cell noise calculations support 2 registered distance function types that define the distance metric used:

Type String Description
Euclidean Standard Euclidean distance (sqrt(dx^2 + dy^2 + dz^2))
Manhattan Manhattan/taxicab distance (`
{
  "ReturnType": {
    "Type": "Distance",
    "DistanceFunction": {
      "Type": "Manhattan"
    }
  }
}

Complete Type Summary

Category Count Types
Noise Generators 4 SimplexNoise2D, SimplexNoise3D, CellNoise2D, CellNoise3D
Math Operations 9 Constant, Sum, Multiplier, Abs, Inverter, Sqrt, Pow, OffsetConstant, AmplitudeConstant
Clamping & Range 10 Clamp, SmoothClamp, Floor, SmoothFloor, Ceiling, SmoothCeiling, Min, SmoothMin, Max, SmoothMax
Mapping & Remapping 3 Normalizer, CurveMapper, Offset/Amplitude
Mixing & Blending 2 Mix, MultiMix
Coordinate Transforms 7 Scale, Slider, Rotator, Anchor, XOverride, YOverride, ZOverride
Warping 3 GradientWarp, FastGradientWarp, VectorWarp
Shape Primitives 9 Distance, Cube, Ellipsoid, Cuboid, Cylinder, Plane, Axis, Shell, Angle
Coordinate Accessors 3 XValue, YValue, ZValue
Context Accessors 4 Terrain, BaseHeight, CellWallDistance, DistanceToBiomeEdge
Gradient 1 Gradient
Caching 3 Cache, Cache2D, YSampled
Conditional 2 Switch, SwitchState
Positions-Based 4 PositionsCellNoise, Positions3D, PositionsPinch, PositionsTwist
Import/Export/Pipeline 3 Exported, Imported, Pipeline
Total 68

Source files: AssetManager.java, DensityAsset.java, Density.java, SimplexNoise2dDensityAsset.java, SimplexNoise3dDensityAsset.java, CellNoise2dDensityAsset.java, CellNoise3dDensityAsset.java, ConstantDensityAsset.java, SumDensityAsset.java, MultiplierDensityAsset.java, AbsDensityAsset.java, InverterDensityAsset.java, SqrtDensityAsset.java, PowDensityAsset.java, ClampDensityAsset.java, SmoothClampDensityAsset.java, FloorDensityAsset.java, SmoothFloorDensityAsset.java, CeilingDensityAsset.java, SmoothCeilingDensityAsset.java, MinDensityAsset.java, SmoothMinDensityAsset.java, MaxDensityAsset.java, SmoothMaxDensityAsset.java, NormalizerDensityAsset.java, CurveMapperDensityAsset.java, MixDensityAsset.java, MultiMixDensityAsset.java, ScaleDensityAsset.java, SliderDensityAsset.java, RotatorDensityAsset.java, AnchorDensityAsset.java, GradientWarpDensityAsset.java, FastGradientWarpDensityAsset.java, VectorWarpDensityAsset.java, DistanceDensityAsset.java, CubeDensityAsset.java, EllipsoidDensityAsset.java, CuboidDensityAsset.java, CylinderDensityAsset.java, PlaneDensityAsset.java, AxisDensityAsset.java, ShellDensityAsset.java, AngleDensityAsset.java, GradientDensityAsset.java, CacheDensityAsset.java, YSampledDensityAsset.java, SwitchDensityAsset.java, SwitchStateDensityAsset.java, ExportedDensityAsset.java, ImportedDensityAsset.java, PipelineDensityAsset.java, ReturnTypeAsset.java, DistanceFunctionAsset.java