Skip to main content

Parallax Mapping

Displaces texture coordinates based on height map and view angle, creating depth illusion without geometry. Used for bricks, cobblestones, panels.

Requires MATERIAL_PARALLAX constant enabled and MATERIAL_UNTEXTURED constant disabled.

Parameters

heightMapScale

float

Default:0.04

Depth scale for parallax displacement effect

heightMapTexture

texture

Default:00000000-0000-0000-0000-000000000000

Height map texture for parallax mapping

Example

With parallax mapping
heightMapScale: 0.05
// Adds depth illusion

heightMapTexture

Grayscale height map. White = maximum height, Black = minimum depth.

heightMapScale

Displacement intensity. 0.04 = subtle, 0.1 = moderate, 0.2 = maximum (may artifact).

Shader Implementation

// UV offset from height map
uv = compute_parallax(
ws_position, ws_normal, ws_tangent, ws_bitangent,
uv, heightMapTexture, heightMapScale
);

// With triplanar - applies to all three planes
apply_parallax_to_triplanar_uvs(sideUv, topUv, frontUv);