2-D PSRDnoise tutorial

Page 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21

Frame rate: FPS

19: Tendrils?

This is exactly the same pattern, only negative, with black and white swapped. Now, it looks a bit like flame tendrils instead. The likeness is not as apparent as for the "clouds", but simply changing the color palette makes the illusion considerably stronger.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
varying vec2 st;
uniform float time;
 
void main(void) {
 
    const float nscale = 4.0;
    vec2 v = nscale * (st-0.5);
    const vec2 p = vec2(4.0, 4.0);
    float alpha = time;
    vec2 g, gsum;
    float warp = 0.13; // Nice "puffy clouds" warping
     
    float n = 0.0;
    float w = 1.0;
    float s = 1.0;
    gsum = vec2(0.0);
    for(float i = 0.0; i<5.0; i++) {
      n += w*psrdnoise(s*v + warp*gsum, s*p, s*alpha, g);
      gsum += w * g;
      w *= 0.5;
      s *= 2.0;
    }
 
    vec3 noisecolor = vec3(0.5-0.4*n);
     
    gl_FragColor = vec4(noisecolor, 1.0);
}