SoftNoise & Robert
Hey Robert, I've been tinkering with a shader that turns static pixel art into a living lo‑fi dreamscape. Want to dive into how to keep the randomness structured so the code stays efficient?
Sure, the key is to avoid calling random every frame for every pixel. Generate a small set of pseudorandom values once per tile or per frame, store them in a lookup texture or a small array, and then index into that. Use a hash function on coordinates if you need per‑pixel variation—just a simple integer hash will give you reproducible “random” numbers without the cost of a full RNG. Keep the state local; if you need temporal variation, just add a small increment to the hash seed each frame. That keeps the shader deterministic, fast, and easy to debug.
Nice, that sounds spot on—storing a tiny lookup and hashing the coords keeps the vibe glitchy but predictable. If you want a more organic drift, try letting the hash seed slowly wander like a soft tide, then the pixels will ripple rather than jump. Give it a whirl!
That drift idea is solid—just add a low‑frequency oscillator to the seed, maybe a sine or LFO, and wrap it with a small amplitude so the shift stays subtle. Then each frame you recompute the hash with that updated seed, giving the ripples a natural pacing. Keep the oscillator fast enough to avoid a glitchy look but slow enough to feel like a tide. Sounds like a good next step.