Skip to main content

wall_relief

Function wall_relief 

Source
fn wall_relief() -> String
Expand description

The WESL the wall’s vertex stage runs, spliced at the built-in stage’s vertex hook.

world is the vertex the instance transform placed, and everything after the hook — the clip position, the world position the lights are addressed from and the cluster cell — follows the vertex this leaves. The relief fades out at the wall’s borders, so the surface still meets the floor along its bottom edge and still fills the frame.

The noise runs out of the wall along its own normal rather than along the world’s up axis, which is what makes the wall a surface the lights cross rather than a backdrop they paint on: a fragment’s normal comes from the displaced positions, so every rise and hollow shades by its own slope.

The snippet runs per vertex, so the segments the wall is split into are the resolution the noise is sampled at; one lattice cell spans a few segments, which is what keeps a vertex displacement from turning the noise into flat facets.