Overview
Expressions are defined in theexpressions/ folder and can be used anywhere Iris accepts procedural streams or generators. They provide fine-grained control over terrain generation through mathematical formulas.
Basic Expression
Built-in Variables
All expressions have access to these inherited variables:x: X coordinatey: Y coordinatez: Z coordinate
Custom Variables
Variables allow you to inject noise generators, engine streams, or static values into your expression.Variable Structure
Variable Types
Style Value
styleValue
Use a noise generator as the variable’s value.
Static Value
staticValue (default: -1)
A constant number used when no other value is defined.
Engine Stream Value
engineStreamValue
Access internal Iris engine data streams.
Engine Value
engineValue
Access single values from the engine (not coordinate-based).
Custom Functions
Functions allow you to call noise generators or engine streams as functions within your expression.Function Structure
hills(x, z) that can be called in your expression.
Function Properties
name (required)
Function name used in the expression. Do not use x, y, or z.
args (default: 2, min: 2)
Number of arguments the function accepts.
args: 3. For 2D, use args: 2.
styleValue
Noise generator to use for function values.
engineStreamValue
Use an engine stream as the function output.
Engine stream functions always use 2 arguments regardless of the
args setting.Expression Syntax
Expressions use standard mathematical notation with operator precedence.Operators
- Addition:
+ - Subtraction:
- - Multiplication:
* - Division:
/ - Parentheses:
() - Exponentiation:
^
Example Expressions
Simple gradient
Using variables
height and terrain are defined variables.
Using functions
hills and mountains are defined functions.
Complex terrain
Complete Examples
Basic Heightmap
Multi-Layer Terrain
- Continental-scale variation (±60 blocks)
- Mountain ranges (±80 blocks)
- Rolling hills (±15 blocks)
Engine-Integrated Expression
Distance-Based Effect
Biome-Blended Terrain
Usage in Dimensions
Expressions can be used anywhere that accepts a generator or stream:As Height Generator
In Styled Ranges
Performance Considerations
- Minimize function calls: Each function call generates noise, which is expensive
- Limit variable count: More variables = more noise generation overhead
- Simplify expressions: Complex math operations add up across millions of blocks
- Cache when possible: Iris caches expression results, but complex expressions still impact first-generation
- Use appropriate zoom levels: Extremely small zoom values (less than 0.01) can cause artifacts
Troubleshooting
Expression fails to load
Check the server logs for parsing errors. Common issues:- Using reserved names (
x,y,z) for variables/functions - Syntax errors in the expression string
- Mismatched parentheses
- Invalid function argument counts
Terrain looks wrong
Verify:- Variable values are in expected ranges (noise returns -1 to 1)
- Multiplication factors create reasonable heights
- Function zoom levels are appropriate for the scale
Performance issues
Simplify the expression by:- Reducing function calls
- Decreasing fractal octaves in styleValues
- Using fewer variables
- Simplifying mathematical operations
NaN or Infinity values
Avoid:- Division by zero
- Invalid exponents (negative base with fractional exponent)
- Overflow from extreme multiplication
Advanced Tips
- Coordinate scaling: Multiply coordinates by small values (0.001-0.1) to control feature scale
- Layer combinations: Add multiple noise layers at different scales for realistic terrain
- Bias centering: Add constants to center noise output (noise is -1 to 1, add 1 to make it 0 to 2)
- Exponential shaping: Use
^to create dramatic peaks:(noise(x, z) + 1)^3 - Conditional logic: Use multiplication by 0/1 factors to simulate if/else
- Distance formulas:
((x - centerX)^2 + (z - centerZ)^2)^0.5for radial effects