Log inGet started
World

Procgen Effects Showcase

Branchmain
Branchesmain
Commit99ff90d12c

README.md

rift_noise

Precision-safe integer-hash value noise and fbm (2D, 3D, and y-periodic variants for seamless time scrolling) shared by the arcane rift shaders. The hashes are integer PCG hashes of the lattice cell, so they stay crisp however large the coordinates grow, and every 2D noise can wrap along y with a period in lattice cells, so a field scrolled by time loops seamlessly. The interpolation is the smoothstep curve f * f * (3 - 2 * f).

A shader includes it with:

#include "rift_noise"

The asset folder holds the same source as module.wgsl and init.wgsl.

Functions

FunctionArgumentsReturns
rn_pcg(v)v: u32A PCG-hashed u32.
rn_hash2(c)c: vec2i, a lattice cellA hash of the cell as an f32 between 0 and 1.
rn_hash3(c)c: vec3i, a lattice cellA hash of the cell as an f32 between 0 and 1.
rn_noise2p(p, period)p: vec2f, period: i322D value noise between 0 and 1. With period above 0, the lattice wraps along y every period cells.
rn_noise2(p)p: vec2frn_noise2p(p, 0): 2D value noise with period 0.
rn_fbm2(p)p: vec2fFive octaves of rn_noise2 with amplitudes 0.5, 0.25, 0.125 and so on; each octave rotates and scales the point by the matrix (1.6, 1.2, -1.2, 1.6) and offsets it.
rn_fbm2p(p, period)p: vec2f, period: i32Four octaves of rn_noise2p, the frequency and the period doubling each octave so every octave wraps along y with the base period.
rn_noise3(p)p: vec3f3D value noise between 0 and 1.
rn_wrap(t, period)t: f32, period: f32t wrapped into [0, period), to keep a time-scrolled coordinate small.

Used by

  • rift_core: rn_fbm2 and rn_noise2 for the tear's jagged edge, the abyss swirl, the rim flicker and the halo tongues.
  • rift_crack: rn_wrap for the surge trains and rn_noise2 for the flicker.
  • rift_mote_cluster: rn_hash3 for each sub-mote's id and rn_wrap for its orbit and twinkle.
  • rift_plume: rn_wrap and rn_fbm2p with a period of 16 for the climbing wisps.