clouds2d: texture-based 4-octave fBm (fizzer-inspired)

Rewrite clouds2d.js to sample a noise texture instead of computing
fBm with hash functions. Each octave is one texture lookup with
doubled UV scale and halved amplitude.

- Same visual range as before but ~4x cheaper on ALU
- REPEAT-wrapped texture tiles seamlessly when scrolled by time
- Per-pixel hash21 jitter keeps the regular tiling from flickering
- Exposes noise as a uniform, so multiple fragment shaders could
  share it
- Theme-agnostic: pulls colours from __currentPalette

Also adds #renderer=clouds2d URL-hash override for quick A/B
testing between the volumetric clouds3d and the 2D version.
This commit is contained in:
Richard Zink committed 2026-10-07 19:40:12 +02:00
1 parent f6f35776bc
commit bfbb73a2af
3 files changed
+300 -209

No files matched your search

+4 -1
View File
@@ -479,8 +479,11 @@
<script>
window.__clouds2dStarted = true;
try {
window.__noiseDataUri = 'data:image/png;base64,PLACEHOLDER';
var noiseDataUri = 'data:image/png;base64,PLACEHOLDER';
var renderer = (window.CONFIG && window.CONFIG.renderer) || 'vanta';
// URL override for easy A/B testing: #renderer=clouds2d / #renderer=clouds3d
var _urlRenderer = (location.hash.match(/renderer=(\w+)/) || [])[1];
var renderer = _urlRenderer || (window.CONFIG && window.CONFIG.renderer) || 'vanta';
var useVanta = (renderer !== 'clouds2d' && renderer !== 'clouds3d');
var effect;
if (useVanta && typeof VANTA !== 'undefined') {