diff --git a/SDF.glsl b/SDF.glsl index cc1c73f..60ace1c 100644 --- a/SDF.glsl +++ b/SDF.glsl @@ -265,6 +265,7 @@ void main() { tot /= float(AA*AA); #endif + /* vec2 crtUV = CRTCurveUV( uv ); if ( crtUV.x < 0.0 || crtUV.x > 1.0 || crtUV.y < 0.0 || crtUV.y > 1.0 ) { @@ -273,5 +274,6 @@ void main() { DrawVignette(tot, crtUV ); DrawScanline(tot,uv); - gl_FragColor = vec4( tot, 1.0 ); + */ + gl_FragColor = vec4( tot, 1.0 ); } \ No newline at end of file diff --git a/SomeFunction/noise/noise.glsl b/SomeFunction/noise/noise.glsl index 0e93a57..4257e6c 100644 --- a/SomeFunction/noise/noise.glsl +++ b/SomeFunction/noise/noise.glsl @@ -3,6 +3,7 @@ vec2 random2(vec2 p) { return fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453); } + float cellular(vec2 p) { p*=10.0; vec2 i_st = floor(p); @@ -11,7 +12,8 @@ float cellular(vec2 p) { for (int j=-1; j<=1; j++ ) { for (int i=-1; i<=1; i++ ) { vec2 neighbor = vec2(float(i),float(j)); - vec2 point = random2(i_st + neighbor); + vec2 point = random2(i_st+neighbor); + //point *= iGlobalTime; point = 0.5 + 0.5*sin(6.2831*point); vec2 diff = neighbor + point - f_st; float dist = length(diff); @@ -28,5 +30,6 @@ void main() { vec2 uv = (gl_FragCoord.xy / iResolution.xx ); float n = 1.0 ; n = cellular(uv); + // n = length(0.5 + 0.5*sin(6.2831*random2(uv))); gl_FragColor = vec4(n,n,n, 1.0); } \ No newline at end of file diff --git a/SomeFunction/random/random.glsl b/SomeFunction/random/random.glsl index eb33786..780d8fe 100644 --- a/SomeFunction/random/random.glsl +++ b/SomeFunction/random/random.glsl @@ -15,7 +15,7 @@ float random_1( vec2 p ) 23.14069263277926, // e^pi (Gelfond's constant) 2.665144142690225 // 2^sqrt(2) (Gelfond–Schneider constant) ); - return fract( cos( mod( 12345678., 256. * dot(p,r) ) ) ); + return fract( cos( mod( 12345678.0, 512.0 * dot(p,r) ) ) ); } float random_2(vec2 p) @@ -98,14 +98,15 @@ float noise( in vec2 p ) { hash( i + vec2(1.0,1.0) ), u.x), u.y); } + void main() { float time = iGlobalTime * 1.0; vec2 uv = (gl_FragCoord.xy / iResolution.xx ); float n = 1.0 ; - // n = random_linear(uv); - // n = random_1(uv); - // n = random_2(uv); - // n = snoise(uv); + //n = random_linear(uv); + //n = random_1(uv); + //n = random_2(uv); + //n = snoise(uv); // n = random_sony(uv); // n = noise(uv); // n = hash(uv); diff --git a/SomeFunction/random/random_02.glsl b/SomeFunction/random/random_02.glsl new file mode 100644 index 0000000..eea7989 --- /dev/null +++ b/SomeFunction/random/random_02.glsl @@ -0,0 +1,67 @@ +float randSeed; + +uint tausStep(uint z,int s1,int s2,int s3,uint M){ + uint b=(((z << s1) ^ z) >> s2); + return (((z & M) << s3) ^ b); +} + +void initRandom(uint seed1,uint seed2,uint seed3){ + uint seed = seed1 * 1099087573U; + uint seedb = seed2 * 1099087573U; + uint seedc = seed3 * 1099087573U; + + // Round 1: Randomise seed + uint z1 = tausStep(seed,13,19,12,429496729U); + uint z2 = tausStep(seed,2,25,4,4294967288U); + uint z3 = tausStep(seed,3,11,17,429496280U); + uint z4 = (1664525U*seed + 1013904223U); + + // Round 2: Randomise seed again using second seed + uint r1 = (z1^z2^z3^z4^seedb); + + z1 = tausStep(r1,13,19,12,429496729U); + z2 = tausStep(r1,2,25,4,4294967288U); + z3 = tausStep(r1,3,11,17,429496280U); + z4 = (1664525U*r1 + 1013904223U); + + // Round 3: Randomise seed again using third seed + r1 = (z1^z2^z3^z4^seedc); + + z1 = tausStep(r1,13,19,12,429496729U); + z2 = tausStep(r1,2,25,4,4294967288U); + z3 = tausStep(r1,3,11,17,429496280U); + z4 = (1664525U*r1 + 1013904223U); + + randSeed = float(z1^z2^z3^z4) * 2.3283064365387e-10; +} + +float getRand(){ + uint hashed_seed = uint(randSeed * float(1099087573U)); + + uint z1 = tausStep(hashed_seed,13,19,12,429496729U); + uint z2 = tausStep(hashed_seed,2,25,4,4294967288U); + uint z3 = tausStep(hashed_seed,3,11,17,429496280U); + uint z4 = (1664525U*hashed_seed + 1013904223U); + + float old_seed = randSeed; + + randSeed = float(z1^z2^z3^z4) * 2.3283064365387e-10; + + return old_seed; +} + +void main() { + float time = iGlobalTime * 1.0; + vec2 uv = gl_FragCoord.xy / iResolution.xy; + //uv -= 0.5; + //uv.x *= iResolution.x / iResolution.y; + //uv *= 2.0; + + uint seedX=uint((uv*vec2(1024)).x); + uint seedY=uint((uv*vec2(1024)).y); + uint seedZ=uint(iFrame); + initRandom(seedX,seedY,seedZ); + float d = getRand(); + gl_FragColor = vec4(d,d,d,1.0); + gl_FragColor.a = 1.0; +} \ No newline at end of file