// #include //ly.img.cesdk/shader/common/ubq_constants // #include //ly.img.cesdk/shader/common/ubq_noise uniform shader image; uniform float2 imageSize; uniform float slices; uniform float offset; uniform float speedV; uniform float time; float steppedVal(float v, float steps) { return floor(v * steps) / steps; } // returns 0 - 1 float random1d(float n) { const float scale = 0.2; const float speed = 1.0; return getNoise(float2(n, n), n, scale, speed); } // returns 0 - 1 float noise1d(float p) { float fl = floor(p); float fc = fract(p); return mix(random1d(fl), random1d(fl + 1.0), fc); } half4 main(float2 coord) { float2 uv = coord / imageSize; // variable width strips float n = noise1d((1 - uv.y) * slices + time * speedV * 3.0); float ns = steppedVal(fract(n), slices) + 2.0; float nsr = random1d(ns); uv.x += nsr * sin(time * TWO_PI + nsr * 20.0) * offset; uv *= imageSize; return image.eval(uv); }