Skip to main content

Triplanar Mapping

Projects textures along world-space axes (X, Y, Z), blending based on surface normal. No UV coordinates required. Ideal for terrain, rocks, procedural geometry.

Requires MATERIAL_TRIPLANAR constant enabled and MATERIAL_UNTEXTURED constant disabled.

Parameters

sharpness

float

Default:1

Transition hardness between projection axes

rotationDeg

vec3

Default:[0,0,0]

Texture rotation angle for each projection axis

triplanarBlendMode

int

Default:0

Blending mode for combining triplanar projections

triplanarParallax

bool

Default:0

Parallax mapping toggle for triplanar projection

triplanarUseLocalSpace

bool

Default:0

Space mode for triplanar projection (world or local)

Example

With triplanar mapping
triplanarScale: 1.0
// No UV stretching

Shader Implementation

// Position source (world or local)
vec3 uvFromPosition = (triplanarUseLocalSpace == 0) ?
ws_position : ls_position * vec3(1,-1,-1);

// Generate UVs for three planes
triplanar_uvs = compute_triplanar_uvs(
uvFromPosition, triplanarScale, triplanarRotationDeg, triplanarOffset
);