StepNoise
Kamoshika uses this function that looks to generate continious random value. code:glsl
float stepNoise(float x, float n) {
n = max(n, 5.);
float i = floor(x);
float s = 0.2;
float u = smoothstep(0.5 - s, 0.5 + s, fract(x));
float res = mix(floor(hash(i) * n), floor(hash(i + 1.) * n), u);
res = res / (n - 1.) - 0.5;
return res;
}
// step(uv.y,stepNoise(uv.x*5+fGlobalTime,30.));
https://scrapbox.io/files/675b2aa28615c43f32c7c398.png
code:glsl
float stepNoise(float x, float n) {
const float factor = 0.3;
float i = floor(x);
float f = x - i;
float u = smoothstep(0.5 - factor, 0.5 + factor, f);
float res = mix(floor(hash(i) * n), floor(hash(i + 1.) * n), u);
res /= (n - 1.) * 0.5;
return res - 1.;
}
//step(uv.y,stepNoise2(uv.x*5+fGlobalTime,30.)*.5)
https://scrapbox.io/files/675b2b8cc89590ad6b3ba5cc.png