Parallax

Pseudo-3D perspective shift from a height map, via ray-marched parallax occlusion mapping.

filter/parallax re-projects its input as if the height map extruded it into relief viewed from an angle:

  1. The height map’s luminosity gives each pixel a height from 0 to 1.

  2. For every output pixel, a view ray angled by direction is marched through the height field until it hits the surface.

  3. The input is sampled where the ray landed — tall features lean away from the viewer and cover what is behind them.

search filter, synth

noise(ridges: true)
  .parallax()
  .write(o0)

With the default heightMap the input acts as its own height map (bright = tall). Wire a different surface to displace one image by another’s relief.

Parameters

Parameter

Type

Default

Description

heightMap

surface

inputTex

Height source; its luminosity is the height field

direction

vec3

[0.5, 0.5, 1]

Viewer angle: straight down (0,0,1) means no shift; glancing angles maximize it

pivot

number (0–1)

0

The height plane that stays anchored: 0 locks the ground so features rise out of it; 1 locks the peaks so valleys sink inward