Log inGet started
World

Procgen Effects Showcase

Branchmain
Branchesmain
Commit99ff90d12c

README.md

wf_sheet

Waterfall curtain: a ballistic vertex path off the lip, packet-timed ribbon noise that tears with distance fallen, aeration to white, backlit scatter and a refracted background.

The vertex stage reads each vertex's place on the sheet back from the grid's own position: u across a 6.8-wide grid and s from 0 at the lip (base_y) to 1 at the bottom of height. It then places the vertex on the path water takes off a lip: it leaves with out_speed and falls under gravity (9.81), so after falling a distance s * height it has moved out_speed * t outward along -Z from z0. The sheet widens by spread toward the bottom, sways a little more the farther it has fallen, and is pushed along -Z by z_bias.

The fragment pins its pattern to packets of water: a packet released at time t0 has fallen 0.5 * g * (t - t0)^2, so the noise is sampled at the time each point's water left the lip. As the water speeds up its streaks stretch, and the sheet tears into ribbons because the breakup threshold rises with the distance fallen. Broad tongues, fine strands and grain come from fx_noise seeded by seed. Aeration turns the water from a deep green-blue to white where the flow is thin and fast, crests catch the sun through a Henyey-Greenstein phase (g 0.55), and the cliff behind shows through, bent by the ripples (zero_scene_color_refract). The tail fades into the plunge over the last 7 percent and the top edge fades in at the lip.

Three materials use it, all alpha-blended with culling off and depth writes off, and the wf_water graph (waterfall/wf_water.procGraph) hangs one curtain from each on a 6.8 by 21.5 grid in the Procgen Effects Showcase world's fx_falls scene:

Materialwidthout_speedspreadseeddensityz_bias
wf_sheet_back9.81.450.2111.1-0.32
wf_sheet_main9.21.70.2231.150
wf_sheet_front7.61.950.26270.80.34

All three use z0 42, base_y 21.9 and height 21.5.

The shader includes fx_noise, zero::scene_depth and zero::scene_color.

Properties

PropertyTypeDefaultMeaning
widthfloat6.6Width of the curtain at the lip (range 0.5 to 40).
heightfloat21.5Height the water falls (range 1 to 80).
z0float0World Z of the lip (range -1000 to 1000).
base_yfloat21.9World height of the lip (range -10 to 100).
out_speedfloat1.7Speed at which the water leaves the lip along -Z (range 0 to 8).
spreadfloat0.22How much wider the curtain is at the bottom, as a fraction of width (range 0 to 1).
seedfloat3Seed for the curtain's noise and sway (range 0 to 99).
densityfloat1.15Multiplies the sheet's body before it becomes alpha (range 0 to 3).
z_biasfloat0.0Shift of the whole curtain along -Z (range -3 to 3); the three curtain materials use -0.32, 0 and 0.34.
vertexBoundsDilationfloat3.5How far the vertex hook moves a vertex past the mesh, in world units: the culling bounds grow by it so a moved vertex stays inside them.