rift_noise.shaderModule
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 wr…
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
| Function | Arguments | Returns |
|---|---|---|
rn_pcg(v) | v: u32 | A PCG-hashed u32. |
rn_hash2(c) | c: vec2i, a lattice cell | A hash of the cell as an f32 between 0 and 1. |
rn_hash3(c) | c: vec3i, a lattice cell | A hash of the cell as an f32 between 0 and 1. |
rn_noise2p(p, period) | p: vec2f, period: i32 | 2D value noise between 0 and 1. With period above 0, the lattice wraps along y every period cells. |
rn_noise2(p) | p: vec2f | rn_noise2p(p, 0): 2D value noise with period 0. |
rn_fbm2(p) | p: vec2f | Five 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: i32 | Four 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: vec3f | 3D value noise between 0 and 1. |
rn_wrap(t, period) | t: f32, period: f32 | t wrapped into [0, period), to keep a time-scrolled coordinate small. |
Used by
rift_core:rn_fbm2andrn_noise2for the tear's jagged edge, the abyss swirl, the rim flicker and the halo tongues.rift_crack:rn_wrapfor the surge trains andrn_noise2for the flicker.rift_mote_cluster:rn_hash3for each sub-mote's id andrn_wrapfor its orbit and twinkle.rift_plume:rn_wrapandrn_fbm2pwith a period of 16 for the climbing wisps.
Scoped to this part · feeds back into the world's score.