Fix shadowing errors & const errors in shaders

This commit is contained in:
Eric Van Albert
2025-11-28 15:09:42 -05:00
parent 20e1f74b2f
commit a2d073bfca
112 changed files with 621 additions and 623 deletions
+8 -8
View File
@@ -3,8 +3,8 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let c = textureSample(iChannelsTex[1], iSampler, uv);
let c = c * smoothstep(0., 0.2, iIntensity);
return composite(textureSample(iInputsTex[0], iSampler, uv), c);
let c2 = c * smoothstep(0., 0.2, iIntensity);
return composite(textureSample(iInputsTex[0], iSampler, uv), c2);
}
#buffershader
@@ -21,9 +21,9 @@ fn getGradient(uv: vec2<f32>) -> vec2<f32> {
let dcdy = (textureSample(iInputsTex[1], iSampler, uv + vec2(0., EPSILON.y)) - val) / EPSILON.y;
let dc = vec2<f32>(dot(dcdx.rgb, vec3<f32>(1.)), dot(dcdy.rgb, vec3<f32>(1.)));
let dc = clamp(0.008 * dc, vec2<f32>(-1.), vec2<f32>(1.));
let dc2 = clamp(0.008 * dc, vec2<f32>(-1.), vec2<f32>(1.));
return dc;
return dc2;
}
fn main(uv: vec2<f32>) -> vec4<f32> {
@@ -37,13 +37,13 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = max(c1, c2);
// Fade out according to the beat
let fragColor = fragColor * pow(defaultPulse, 0.3);
let fragColor2 = fragColor * pow(defaultPulse, 0.3);
// Fade out slowly
let fadeAmount = 0.01 + 0.2 * (1. - iIntensity);
let fragColor = max(fragColor - fadeAmount, vec4<f32>(0.));
let fragColor3 = max(fragColor2 - fadeAmount, vec4<f32>(0.));
// Clear back buffer when intensity is low
let fragColor = fragColor * smoothstep(0., 0.1, iIntensity);
return fragColor;
let fragColor4 = fragColor3 * smoothstep(0., 0.1, iIntensity);
return fragColor4;
}
+2 -2
View File
@@ -9,7 +9,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
// Even when halfWidth = 0.5, smoothstep is not the identity
// so we mix here to preserve keep the identity
let color = mix(color, targetColor, iIntensity * pow(defaultPulse, 2.));
let color2 = mix(color, targetColor, iIntensity * pow(defaultPulse, 2.));
return premultiply(vec4<f32>(color, color4.a));
return premultiply(vec4<f32>(color2, color4.a));
}
+1 -1
View File
@@ -2,5 +2,5 @@
#property frequency 1
fn main(uv: vec2<f32>) -> vec4<f32> {
return extureSample(iInputsTex[0], iSampler, uv);
return textureSample(iInputsTex[0], iSampler, uv);
}
+2 -2
View File
@@ -5,7 +5,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let c = textureSample(iInputsTex[0], iSampler, uv);
let darkness = select(smoothstep(0., 0.2, iIntensity), pow(iIntensity, 2.), iFrequency == 0.);
let darkness = vec4(0., 0., 0., 1.) * pow(defaultPulse, (iIntensity + 0.5) * 2.) * darkness;
let darkness2 = vec4(0., 0., 0., 1.) * pow(defaultPulse, (iIntensity + 0.5) * 2.) * darkness;
return composite(c, darkness);
return composite(c, darkness2);
}
+27 -27
View File
@@ -5,11 +5,11 @@
#property frequency 1
#property inputCount 2
let MAX_MARCHING_STEPS: i32 = 255;
let STEP_SIZE: f32 = 0.7;
let MIN_DIST: f32 = 0.0;
let MAX_DIST: f32 = 100.0;
let EPSILON: f32 = 0.001;
const MAX_MARCHING_STEPS: i32 = 255;
const STEP_SIZE: f32 = 0.7;
const MIN_DIST: f32 = 0.0;
const MAX_DIST: f32 = 100.0;
const EPSILON: f32 = 0.001;
/**
* Signed distance function describing the scene.
@@ -21,12 +21,12 @@ let EPSILON: f32 = 0.001;
// Displacement based on a single parameter
fn disp(x: f32) -> f32 {
let x = x * 0.3;
let wave = 1.8 * sin(x * 10. + iTime * iFrequency * 0.1) * iAudioLow;
let wave = wave + 1.2 * sin(x * 20. + iTime * iFrequency * 0.1) * iAudioMid;
let wave = wave + 0.6 * sin(x * 70. + iTime * iFrequency * 0.1) * iAudioHi;
let wave = wave * iIntensity;
return wave;
let x2 = x * 0.3;
let wave = 1.8 * sin(x2 * 10. + iTime * iFrequency * 0.1) * iAudioLow;
let wave2 = wave + 1.2 * sin(x2 * 20. + iTime * iFrequency * 0.1) * iAudioMid;
let wave3 = wave2 + 0.6 * sin(x2 * 70. + iTime * iFrequency * 0.1) * iAudioHi;
let wave4 = wave3 * iIntensity;
return wave4;
}
// Displacement of the sphere at a point p
@@ -112,14 +112,14 @@ fn phongContribForLight(k_d: vec3<f32>, k_s: vec3<f32>, alpha: f32, p: vec3<f32>
let up = vec3(0., 1., 0.);
let u = normalize(cross(N, up));
let v = cross(N, u);
let N = N + u * perturb.x + v * perturb.y;
let N = normalize(N);
let N2 = N + u * perturb.x + v * perturb.y;
let N3 = normalize(N2);
let L = normalize(lightPos - p);
let V = normalize(eye - p);
let R = normalize(reflect(-L, N));
let R = normalize(reflect(-L, N3));
let dotLN = dot(L, N);
let dotLN = dot(L, N3);
let dotRV = dot(R, V);
if (dotLN < 0.0) {
@@ -151,27 +151,27 @@ fn phongContribForLight(k_d: vec3<f32>, k_s: vec3<f32>, alpha: f32, p: vec3<f32>
fn phongIllumination(k_a: vec3<f32>, k_d: vec3<f32>, k_s: vec3<f32>, alpha: f32, p: vec3<f32>, eye: vec3<f32>, perturb: vec2<f32>) -> vec3<f32> {
let ambientLight = 0.5 * vec3<f32>(1.0, 1.0, 1.0);
let color = ambientLight * k_a;
let light1Pos = vec3<f32>(20.0,
20.0,
20.0);
//light1Pos += eye;
let light1Intensity = vec3<f32>(0.4, 0.4, 0.4);
let color = color + phongContribForLight(k_d, k_s, alpha, p, eye,
let color2 = color + phongContribForLight(k_d, k_s, alpha, p, eye,
light1Pos,
light1Intensity, perturb);
let light2Pos = vec3<f32>(-20.0,
-20.0,
-20.0);
let light2Intensity = vec3<f32>(0.4, 0.4, 0.4);
let color = color + phongContribForLight(k_d, k_s, alpha, p, eye,
let color3 = color2 + phongContribForLight(k_d, k_s, alpha, p, eye,
light2Pos,
light2Intensity, perturb);
return color;
light2Intensity, perturb);
return color3;
}
/**
@@ -214,11 +214,11 @@ fn main(uv: vec2<f32>) -> vec4<f32>
let p = eye + dist * worldDir;
let texCoord = p.zy;
let texCoord = texCoord + dispP(p) * normalize(texCoord);
let texCoord = texCoord / max(iIntensity * 1.01, 0.001);
let texCoord = 0.5 * texCoord + 0.5;
let texCoord2 = texCoord + dispP(p) * normalize(texCoord);
let texCoord3 = texCoord2 / max(iIntensity * 1.01, 0.001);
let texCoord4 = 0.5 * texCoord3 + 0.5;
let texColor = textureSampleLevel(iInputsTex[0], iSampler, texCoord, 0.).rgb * box(texCoord);
let texColor = textureSampleLevel(iInputsTex[0], iSampler, texCoord4, 0.).rgb * box(texCoord4);
let K_a = texColor * 0.3;
let K_d = texColor * 1.3;
let K_s = vec3<f32>(1.0, 1.0, 1.0);
+18 -18
View File
@@ -11,28 +11,28 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let o = vec3<f32>(-off, 0.0, off);
let gx = vec4<f32>(0.0);
let gy = vec4<f32>(0.0);
let gx = gx + get_texture(uv, o.xz, cor);
let gy = gy + gx;
let gx = gx + 2.0 * get_texture(uv, o.xy, cor);
let gx2 = gx + get_texture(uv, o.xz, cor);
let gy2 = gy + gx2;
let gx3 = gx2 + 2.0 * get_texture(uv, o.xy, cor);
let t = get_texture(uv, o.xx, cor);
let gx = gx + t;
let gy = gy - t;
let gy = gy + 2.0 * get_texture(uv, o.yz, cor);
let gy = gy - 2.0 * get_texture(uv, o.yx, cor);
let t = get_texture(uv, o.zz, cor);
let gx = gx - t;
let gy = gy + t;
let gx = gx - 2.0 * get_texture(uv, o.zy,cor);
let t = get_texture(uv, o.zx,cor);
let gx = gx - t;
let gy = gy - t;
let gx4 = gx3 + t;
let gy3 = gy2 - t;
let gy4 = gy3 + 2.0 * get_texture(uv, o.yz, cor);
let gy5 = gy4 - 2.0 * get_texture(uv, o.yx, cor);
let t2 = get_texture(uv, o.zz, cor);
let gx5 = gx4 - t2;
let gy6 = gy5 + t2;
let gx6 = gx5 - 2.0 * get_texture(uv, o.zy,cor);
let t3 = get_texture(uv, o.zx,cor);
let gx7 = gx6 - t3;
let gy7 = gy6 - t3;
let grad = sqrt(gx * gx + gy * gy);
let grad = vec4<f32>(grad.xyz / sqrt(off), grad.a);
let grad = vec4<f32>(grad.xyz, max(max(grad.r, grad.g), max(grad.b, grad.a)));
let grad = sqrt(gx7 * gx7 + gy7 * gy7);
let grad2 = vec4<f32>(grad.xyz / sqrt(off), grad.a);
let grad3 = vec4<f32>(grad2.xyz, max(max(grad2.r, grad2.g), max(grad2.b, grad2.a)));
let original = textureSample(iInputsTex[0], iSampler, uv);
return mix(original, grad, smoothstep(0., 0.3, iIntensity));
return mix(original, grad3, smoothstep(0., 0.3, iIntensity));
}
+6 -6
View File
@@ -7,13 +7,13 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = (uv - 0.5) * aspectCorrection;
let t = iFrequency * iTime * 0.0625 * pi;
let center = vec2(sin(t), cos(t));
let center = center * iAudioLevel * 0.9 + 0.1;
let center2 = center * iAudioLevel * 0.9 + 0.1;
let a = clamp(length(center - normCoord), 0., 1.);
let a = pow(a, iAudioHi * 3. + 0.1);
let a = 1.0 - a;
let a = a * iIntensity;
let c = vec4(1., 1., 0., 1.) * a;
let a = clamp(length(center2 - normCoord), 0., 1.);
let a2 = pow(a, iAudioHi * 3. + 0.1);
let a3 = 1.0 - a2;
let a4 = a3 * iIntensity;
let c = vec4(1., 1., 0., 1.) * a4;
return composite(textureSample(iInputsTex[0], iSampler, uv), c);
}
+3 -3
View File
@@ -1,8 +1,8 @@
#property description Rotate the 'object' in 3D, like a coin
#property frequency 1
let WIDTH = 0.1;
let ITERS = 64;
const WIDTH: f32 = 0.1;
const ITERS: i32 = 64;
fn lookup(coord: vec2<f32>) -> vec4<f32> {
let xy = coord / aspectCorrection + 0.5;
@@ -20,7 +20,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
} else {
phi = iIntensity * pi;
}
var s = vec2<f32>(s.x / cos(phi), s.y);
s = vec2<f32>(s.x / cos(phi), s.y);
// This isn't quite right, but it's super easy compared to real geometry
d *= abs(cos(phi)) * sign(sin(phi * 2.));
+3 -3
View File
@@ -4,10 +4,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let h = clamp((iIntensity - 0.25) / 0.9, 0.0, 1.0);
let color = hsv2rgb(vec3(h, 1.0, 1.0));
let color = mix(vec3(0.0), color, smoothstep(0.10, 0.12, iIntensity));
let color = mix(color, vec3(1.0), smoothstep(0.90, 1.00, iIntensity));
let color2 = mix(vec3(0.0), color, smoothstep(0.10, 0.12, iIntensity));
let color3 = mix(color2, vec3(1.0), smoothstep(0.90, 1.00, iIntensity));
let c = textureSample(iInputsTex[0], iSampler, uv);
return mix(c, vec4(color, 1.0), smoothstep(0.0, 0.1, iIntensity));
return mix(c, vec4(color3, 1.0), smoothstep(0.0, 0.1, iIntensity));
}
+7 -7
View File
@@ -10,10 +10,10 @@ fn dist(pt: vec2<f32>, xbound: vec2<f32>, y: f32) -> f32 {
let d = abs(pt.y - y);
// L1 distance from endpoints (to give sharp, diamond corners)
let d = d + step(pt.x, xbound.x) * (xbound.x - pt.x);
let d = d + step(xbound.y, pt.x) * (pt.x - xbound.y);
let d2 = d + step(pt.x, xbound.x) * (xbound.x - pt.x);
let d3 = d2 + step(xbound.y, pt.x) * (pt.x - xbound.y);
return d;
return d3;
}
fn bound(low: f32, high: f32, eps: f32, t: f32) -> f32 {
@@ -56,11 +56,11 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
+ four * bound(1.0, 2.0, 0.10, tOff);
let alpha = 1.0 - smoothstep(0.02, 0.04, totalDist);
let alpha = clamp(0., 1., alpha);
let alpha2 = clamp(0., 1., alpha);
let color = vec4(1.0, 0.2, 0.0, 1.0); // Red
let color = color * alpha;
let color = color * iIntensity;
let color2 = color * alpha2;
let color3 = color2 * iIntensity;
return composite(textureSample(iInputsTex[0], iSampler, uv), color);
return composite(textureSample(iInputsTex[0], iSampler, uv), color3);
}
+5 -5
View File
@@ -1,7 +1,7 @@
#property description And the cracks begin to show
#property frequency 0.5
let MAX_CRACKS = 15;
const MAX_CRACKS: i32 = 15;
fn main(uv: vec2<f32>) -> vec4<f32> {
// Number of cracks dependent on intensity
@@ -28,14 +28,14 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
// .zw is the direction vector
let crackParameters = textureSample(iNoiseTex, iSampler, vec2(f32(i) + floor(t)) * onePixel * aspectCorrection);
let crackParametersZw = crackParameters.zw - 0.5;
let crackParametersZw = crackParametersZw / length(crackParametersZw);
let crackParameters = vec4<f32>(crackParameters.xy, crackParametersZw);
let crackParametersZw2 = crackParametersZw / length(crackParametersZw);
let crackParameters2 = vec4<f32>(crackParameters.xy, crackParametersZw2);
// Find the vector normal to the crack
let normalVector = crackParameters.wz * vec2(-1., 1.);
let normalVector = crackParameters2.wz * vec2(-1., 1.);
// Find which side of the crack we are on
let side = dot(uv - crackParameters.xy, normalVector);
let side = dot(uv - crackParameters2.xy, normalVector);
// Perturb the input towards the crack
// (as if a mirror were shattered by hitting it)
+4 -4
View File
@@ -13,10 +13,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let blueImage = textureSample(iInputsTex[0], iSampler, blueOffset / aspectCorrection + 0.5);
let rgb = vec3(redImage.r, greenImage.g, blueImage.b);
let rgb = rgb * mix(1.0, 1.0 - pow(abs(sin(greenOffset.y * 160.0)), 16.), iIntensity * pulse / 3.0);
let r = rgb.r * mix(1.0, 1.0 - pow(abs(sin(redOffset.x * 200.0)), 6.), iIntensity * pulse);
let g = rgb.g * mix(1.0, 1.0 - pow(abs(sin(greenOffset.x * 200.0)), 6.), iIntensity * pulse);
let b = rgb.b * mix(1.0, 1.0 - pow(abs(sin(blueOffset.x * 200.0)), 6.), iIntensity * pulse);
let rgb2 = rgb * mix(1.0, 1.0 - pow(abs(sin(greenOffset.y * 160.0)), 16.), iIntensity * pulse / 3.0);
let r = rgb2.r * mix(1.0, 1.0 - pow(abs(sin(redOffset.x * 200.0)), 6.), iIntensity * pulse);
let g = rgb2.g * mix(1.0, 1.0 - pow(abs(sin(greenOffset.x * 200.0)), 6.), iIntensity * pulse);
let b = rgb2.b * mix(1.0, 1.0 - pow(abs(sin(blueOffset.x * 200.0)), 6.), iIntensity * pulse);
let a_out = max(max(greenImage.a, r), max(g, b));
return vec4(r, g, b, a_out);
}
+6 -6
View File
@@ -29,7 +29,7 @@ fn draw(bottomLeft: vec2<f32>, bottomRight: vec2<f32>, topLeft: vec2<f32>, topRi
let e = inverse3(a) * d;
// Step 2: Scale matrix a by e
let a = mat3x3<f32>(
let a2 = mat3x3<f32>(
a[0] * e.x,
a[1] * e.y,
a[2] * e.z,
@@ -43,7 +43,7 @@ fn draw(bottomLeft: vec2<f32>, bottomRight: vec2<f32>, topLeft: vec2<f32>, topRi
// Step 4, 5: Get the combined matrix transform c
// TODO inverse can be replaced with adjugate
let c = b * inverse3(a);
let c = b * inverse3(a2);
// Step 6: Project the point uv using transform c
let h = c * vec3((uv - 0.5) * mix(vec2(1.), aspectCorrection, ssi), 1.);
@@ -95,13 +95,13 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let t = iIntensityIntegral * iFrequency + 1.;
let eye = vec3<f32>(sin(t), sin(0.5 * t), cos(t));
let eye = mix(vec3<f32>(0., 0., 1.), eye, ssi);
let eye2 = mix(vec3<f32>(0., 0., 1.), eye, ssi);
// TODO inverse can be replaced with adjugate
let xf = xf * inverse4(viewMatrix(eye, -eye, vec3<f32>(0., 1., 0.)));
let xf2 = xf * inverse4(viewMatrix(eye2, -eye2, vec3<f32>(0., 1., 0.)));
// Use the transformation matrix xf to project cubePoints
// Use the transformation matrix xf2 to project cubePoints
for (var i: i32 = 0; i < 8; i++) {
let h = xf * vec4(cubePoints[i], 1.);
let h = xf2 * vec4(cubePoints[i], 1.);
let cubePointXY = h.xy / h.w;
// Don't project z, we will use that for occlusion checking
let cubePointZ = h.z;
+4 -4
View File
@@ -12,9 +12,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let c = vec4(0., 1., 1., 1.) * y;
let d = vec4(0., 0., 1., 1.) * g * smoothstep(0.5, 0.8, iIntensity);
let c = composite(c, d);
let c2 = composite(c, d);
let c = c * smoothstep(0., 0.1, iIntensity);
let c = clamp(c, vec4<f32>(0.), vec4<f32>(1.));
return composite(o, c);
let c3 = c2 * smoothstep(0., 0.1, iIntensity);
let c4 = clamp(c3, vec4<f32>(0.), vec4<f32>(1.));
return composite(o, c4);
}
+2 -2
View File
@@ -10,7 +10,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let switcher = 0.5 * clamp(amt * sin(iTime * iFrequency * pi), -1., 1.) + 0.5;
let which = mix(0., switcher, smoothstep(0., 0.1, iIntensity));
let which = mix(which, 1., smoothstep(0.9, 1., iIntensity));
let which2 = mix(which, 1., smoothstep(0.9, 1., iIntensity));
return mix(l, r, which);
return mix(l, r, which2);
}
+7 -7
View File
@@ -3,13 +3,13 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let angle = (iTime * iFrequency - 0.5) * pi;
let angle = angle + 2. * asin(2. * (uv.x - 0.5));
let angle2 = angle + 2. * asin(2. * (uv.x - 0.5));
let x = modulo(angle / pi, 2.0);
let x = x - 1.0;
let x = abs(x);
let x = modulo(angle2 / pi, 2.0);
let x2 = x - 1.0;
let x3 = abs(x2);
let new_uv = vec2(x, uv.y);
let new_uv = mix(uv, new_uv, iIntensity);
return textureSample(iInputsTex[0], iSampler, new_uv);
let new_uv = vec2(x3, uv.y);
let new_uv2 = mix(uv, new_uv, iIntensity);
return textureSample(iInputsTex[0], iSampler, new_uv2);
}
+3 -3
View File
@@ -3,7 +3,7 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let c = textureSample(iInputsTex[0], iSampler, uv);
let a = (1. - iIntensity * pow(defaultPulse, 2.));
let a = max(0.0001, max(a, c.a));
let c = c / a;
return c;
let a2 = max(0.0001, max(a, c.a));
let c2 = c / a2;
return c2;
}
+4 -4
View File
@@ -1,18 +1,18 @@
#property description Introduce a delay (and reduce resolution)
let SZ = 6.; // Delay of SZ*SZ frames (36)
const SZ: f32 = 6.; // Delay of SZ*SZ frames (36)
fn main(uv: vec2<f32>) -> vec4<f32> {
let original = textureSample(iInputsTex[0], iSampler, uv);
let shift = floor(iResolution / SZ) / iResolution;
let uvNew = uv * shift;
let uvNew = mix(uvNew, uv, smoothstep(0.8, 0.9, iIntensity));
let delayed = textureSample(iChannelsTex[1], iSampler, uvNew);
let uvNew2 = mix(uvNew, uv, smoothstep(0.8, 0.9, iIntensity));
let delayed = textureSample(iChannelsTex[1], iSampler, uvNew2);
return mix(original, delayed, smoothstep(0., 0.2, iIntensity));
}
#buffershader
let SZ = 6.; // Delay of SZ*SZ frames (36)
const SZ: f32 = 6.; // Delay of SZ*SZ frames (36)
fn main(uv: vec2<f32>) -> vec4<f32> {
let shift = floor(iResolution / SZ) / iResolution;
let maxShift = shift * SZ;
+3 -3
View File
@@ -4,10 +4,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let angle = (uv.y + 0.25 * iTime * iFrequency) * pi;
let lengthFactor = 1.0; // sqrt(2.);
let rtheta = uv.x * lengthFactor * vec2<f32>(sin(angle), -cos(angle));
let rtheta = rtheta / aspectCorrection;
let rtheta = (rtheta + 1.) / 2.;
let rtheta2 = rtheta / aspectCorrection;
let rtheta3 = (rtheta2 + 1.) / 2.;
let uv2 = mix(uv, rtheta, iIntensity);
let uv2 = mix(uv, rtheta3, iIntensity);
return textureSample(iInputsTex[0], iSampler, uv2);
}
+3 -3
View File
@@ -8,9 +8,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let yuv = rgb2yuv(samp.rgb);
let color_y = yuv.r;
let color_uv = yuv.gb - (0.5);
let color_uv = color_uv * (1.0 - factor);
let color_uv = color_uv + (0.5);
let rgb = yuv2rgb(vec3<f32>(color_y, color_uv));
let color_uv2 = color_uv * (1.0 - factor);
let color_uv3 = color_uv2 + (0.5);
let rgb = yuv2rgb(vec3<f32>(color_y, color_uv3));
let fragColor = premultiply(vec4<f32>(rgb, samp.a));
return fragColor;
+2 -2
View File
@@ -7,8 +7,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let smoothed = mix(next, prev, pow(iIntensity, 0.4));
let sharp = next;
let fragColor = select(sharp, smoothed, next.a > prev.a);
let fragColor = clamp(fragColor, vec4<f32>(0.), vec4<f32>(1.));
return fragColor;
let fragColor2 = clamp(fragColor, vec4<f32>(0.), vec4<f32>(1.));
return fragColor2;
}
#buffershader
+2 -2
View File
@@ -3,6 +3,6 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let prev = textureSample(iChannelsTex[0], iSampler, uv);
let next = textureSample(iInputsTex[0], iSampler, uv);
let prev = prev * (pow(iIntensity, 0.1)) * (1. - pow(defaultPulse, 4.));
return max(prev, next);
let prev2 = prev * (pow(iIntensity, 0.1)) * (1. - pow(defaultPulse, 4.));
return max(prev2, next);
}
+5 -5
View File
@@ -3,12 +3,12 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let noise_input = vec3<f32>(uv, iTime * 0.3);
let shift = vec2<f32>(noise3(noise_input), noise3(noise_input + 100.)) - 0.5;
let shift = shift + (vec2<f32>(noise3(2. * noise_input), noise3(2. * noise_input + 100.)) - 0.5) * 0.5;
let shift = shift + (vec2<f32>(noise3(4. * noise_input), noise3(4. * noise_input + 100.)) - 0.5) * 0.25;
let shift = 0.3 * shift;
let shift = shift / aspectCorrection;
let shift2 = shift + (vec2<f32>(noise3(2. * noise_input), noise3(2. * noise_input + 100.)) - 0.5) * 0.5;
let shift3 = shift2 + (vec2<f32>(noise3(4. * noise_input), noise3(4. * noise_input + 100.)) - 0.5) * 0.25;
let shift4 = 0.3 * shift3;
let shift5 = shift4 / aspectCorrection;
let newUV = uv + shift * iIntensity * pow(defaultPulse, 2.) * 5.;
let newUV = uv + shift5 * iIntensity * pow(defaultPulse, 2.) * 5.;
return textureSample(iInputsTex[0], iSampler, newUV);
}
+4 -4
View File
@@ -5,11 +5,11 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let hsv = rgb2hsv(fragColor.rgb);
let h = hsv.x;
let h = (h - 1. / 12.) % 1. - 6. / 12.;
let h = h * (1. - iIntensity * 0.7);
let h = (h + 7. / 12.) % 1.;
let h2 = (h - 1. / 12.) % 1. - 6. / 12.;
let h3 = h2 * (1. - iIntensity * 0.7);
let h4 = (h3 + 7. / 12.) % 1.;
let s = mix(hsv.y, 0., iIntensity * pulse * 0.4);
let v = mix(hsv.z, 0., iIntensity * pulse * 0.3);
let rgb = hsv2rgb(vec3<f32>(h, s, v));
let rgb = hsv2rgb(vec3<f32>(h4, s, v));
return vec4<f32>(rgb, max(max(max(fragColor.a, rgb.r), rgb.g), rgb.b));
}
+19 -19
View File
@@ -10,29 +10,29 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let offy = onePixel.y;
let gx = vec4<f32>(0.0);
let gy = vec4<f32>(0.0);
let gx = gx + get_texture(uv + vec2<f32>(-offx, offy));
let gy = gy + gx;
let gx = gx + 2.0*get_texture(uv + vec2<f32>(-offx, 0.));
let gx2 = gx + get_texture(uv + vec2<f32>(-offx, offy));
let gy2 = gy + gx2;
let gx3 = gx2 + 2.0*get_texture(uv + vec2<f32>(-offx, 0.));
let t = get_texture(uv + vec2<f32>(-offx, -offy));
let gx = gx + t;
let gy = gy - t;
let gy = gy + 2.0*get_texture(uv + vec2<f32>(0., offy));
let gy = gy - 2.0*get_texture(uv + vec2<f32>(0., -offy));
let t = get_texture(uv + vec2<f32>(offx, offy));
let gx = gx - t;
let gy = gy + t;
let gx = gx - 2.0*get_texture(uv + vec2<f32>(offx, 0.));
let t = get_texture(uv + vec2<f32>(-offx, offy));
let gx = gx - t;
let gy = gy - t;
let grad = sqrt(gx * gx + gy * gy);
let gx4 = gx3 + t;
let gy3 = gy2 - t;
let gy4 = gy3 + 2.0*get_texture(uv + vec2<f32>(0., offy));
let gy5 = gy4 - 2.0*get_texture(uv + vec2<f32>(0., -offy));
let t2 = get_texture(uv + vec2<f32>(offx, offy));
let gx5 = gx4 - t2;
let gy6 = gy5 + t2;
let gx6 = gx5 - 2.0*get_texture(uv + vec2<f32>(offx, 0.));
let t3 = get_texture(uv + vec2<f32>(-offx, offy));
let gx7 = gx6 - t3;
let gy7 = gy6 - t3;
let grad = sqrt(gx7 * gx7 + gy7 * gy7);
let grad_a = max(max(grad.r, grad.g), max(grad.b, grad.a));
let grad = vec4<f32>(grad.xyz, grad_a);
let grad2 = vec4<f32>(grad.xyz, grad_a);
let original = textureSample(iInputsTex[0], iSampler, uv);
let parameter = iIntensity * pow(defaultPulse, 2.);
let grad = grad * smoothstep(0., 0.5, parameter);
let original = original * (1. - smoothstep(0.5, 1., parameter));
let grad3 = grad2 * smoothstep(0., 0.5, parameter);
let original2 = original * (1. - smoothstep(0.5, 1., parameter));
return composite(original, grad);
return composite(original2, grad3);
}
+2 -2
View File
@@ -19,8 +19,8 @@ fn estimateNormal(uv: vec2<f32>) -> vec3<f32> {
// Take a small step in Y
let ptStepY = uv + vec2<f32>(0., onePixel.y);
let z = height(ptStepY);
let stepY = vec3<f32>(ptStepY, z) - pt;
let z2 = height(ptStepY);
let stepY = vec3<f32>(ptStepY, z2) - pt;
// Return the cross product of these vectors
// to get the surface normal
+3 -3
View File
@@ -22,9 +22,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let eyeShape = smoothstep(0.8 + a, 1.0 + a, length(abs(normCoord) + vec2<f32>(0., 0.7)));
let newUV = mix(newUVCenter, newUVMiddle, centerShape);
let newUV = mix(newUV, newUVOutside, eyeShape);
let newUV2 = mix(newUV, newUVOutside, eyeShape);
let newUV = newUV / aspectCorrection + 0.5;
let newUV3 = newUV2 / aspectCorrection + 0.5;
return textureSample(iInputsTex[0], iSampler, mix(uv, newUV, iIntensity));
return textureSample(iInputsTex[0], iSampler, mix(uv, newUV3, iIntensity));
}
+2 -2
View File
@@ -21,9 +21,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let v = (textureSample(iChannelsTex[1], iSampler, vec2<f32>(0.5, 0.5)).r + 1. - parameter) % 1.;
// If intensity is low, decay to zero
let v = max(0., v - 0.02 * (1. - step(0.03, iIntensity)));
let v2 = max(0., v - 0.02 * (1. - step(0.03, iIntensity)));
return vec4<f32>(v);
return vec4<f32>(v2);
}
#buffershader
+8 -8
View File
@@ -7,15 +7,15 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let noise_input = vec3<f32>(normCoord * 3. + vec2<f32>(0., iTime * 0.5), iTime * 0.25);
let shift = (vec2<f32>(noise3(noise_input), noise3(noise_input + 100.)) - 0.5);
let shift = shift + (vec2<f32>(noise3(2. * noise_input), noise3(2. * noise_input + 100.)) - 0.5) * 0.5;
let shift = shift + (vec2<f32>(noise3(4. * noise_input), noise3(4. * noise_input + 100.)) - 0.5) * 0.25;
let shift = (iIntensity * 0.5 + 0.5) * (0.7 * pow(defaultPulse, 2.) + 0.3) * shift + vec2<f32>(0., -0.5 + 0.5 * iIntensity);
let shift = shift / aspectCorrection;
let shift2 = shift + (vec2<f32>(noise3(2. * noise_input), noise3(2. * noise_input + 100.)) - 0.5) * 0.5;
let shift3 = shift2 + (vec2<f32>(noise3(4. * noise_input), noise3(4. * noise_input + 100.)) - 0.5) * 0.25;
let shift4 = (iIntensity * 0.5 + 0.5) * (0.7 * pow(defaultPulse, 2.) + 0.3) * shift3 + vec2<f32>(0., -0.5 + 0.5 * iIntensity);
let shift5 = shift4 / aspectCorrection;
let uv2 = uv + shift;
let uv2 = uv + shift5;
let color = vec4<f32>(1., (1. - uv2.y) * 0.6, 0., 1.0);
let color = color * smoothstep(0.1, 0.3, uv2.y);
let color = color * smoothstep(0., 0.2, iIntensity);
let color2 = color * smoothstep(0.1, 0.3, uv2.y);
let color3 = color2 * smoothstep(0., 0.2, iIntensity);
return composite(fragColor, color);
return composite(fragColor, color3);
}
+8 -8
View File
@@ -7,14 +7,14 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let noise_input = vec3<f32>(length(normCoord) * 3. - iTime, abs(atan2(normCoord.y, normCoord.x)), iTime * 0.3);
let shift = vec2<f32>(noise3(noise_input), noise3(noise_input + 100.)) - 0.5;
let shift = shift + (vec2<f32>(noise3(2. * noise_input), noise3(2. * noise_input + 100.)) - 0.5) * 0.5;
let shift = shift + (vec2<f32>(noise3(4. * noise_input), noise3(4. * noise_input + 100.)) - 0.5) * 0.25;
let shift = (iIntensity * 0.7 + 0.3) * shift * (0.3 + 0.7 * pow(defaultPulse, 2.));
let shift2 = shift + (vec2<f32>(noise3(2. * noise_input), noise3(2. * noise_input + 100.)) - 0.5) * 0.5;
let shift3 = shift2 + (vec2<f32>(noise3(4. * noise_input), noise3(4. * noise_input + 100.)) - 0.5) * 0.25;
let shift4 = (iIntensity * 0.7 + 0.3) * shift3 * (0.3 + 0.7 * pow(defaultPulse, 2.));
let normCoord = normCoord + shift;
let color = vec4<f32>(1., clamp(length(normCoord) * 2., 0., 1.), 0., 1.0);
let color = color * smoothstep(0.4, 0.5, (1. - length(normCoord)));
let color = color * smoothstep(0., 0.2, iIntensity);
let normCoord2 = normCoord + shift4;
let color = vec4<f32>(1., clamp(length(normCoord2) * 2., 0., 1.), 0., 1.0);
let color2 = color * smoothstep(0.4, 0.5, (1. - length(normCoord2)));
let color3 = color2 * smoothstep(0., 0.2, iIntensity);
return composite(fragColor, color);
return composite(fragColor, color3);
}
+5 -5
View File
@@ -2,18 +2,18 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let timeOffset = vec2<f32>(iTime * iFrequency * (1. / 64.));// * sign(uv.x + uv.y - 1.);
let timeOffset = (timeOffset + 1.) % 2. - 1.;
let newPt = (uv - 0.5 - timeOffset) * aspectCorrection;
let timeOffset2 = (timeOffset + 1.) % 2. - 1.;
let newPt = (uv - 0.5 - timeOffset2) * aspectCorrection;
let bins = mix(50., 3., iIntensity);
let newPtInt = floor(newPt * bins);
let newPtFrac = fract(newPt * bins);
let newPtFrac = 1. - newPtFrac.yx;
let newPtFrac2 = 1. - newPtFrac.yx;
let newPt = (newPtInt + newPtFrac) / bins;
let newPt2 = (newPtInt + newPtFrac2) / bins;
let fragColor = textureSample(iInputsTex[0], iSampler, newPt / aspectCorrection + 0.5 + timeOffset);
let fragColor = textureSample(iInputsTex[0], iSampler, newPt2 / aspectCorrection + 0.5 + timeOffset2);
return mix(textureSample(iInputsTex[0], iSampler, uv), fragColor, smoothstep(0., 0.1, iIntensity));
}
+5 -5
View File
@@ -4,15 +4,15 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let c = textureSample(iChannelsTex[1], iSampler, uv);
let c = c * (smoothstep(0., 0.2, iIntensity));
return composite(c, fragColor);
let c2 = c * (smoothstep(0., 0.2, iIntensity));
return composite(c2, fragColor);
}
#buffershader
fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iChannelsTex[1], iSampler, (uv - 0.5) * 0.98 + 0.5);
let fragColor = fragColor * (exp((iIntensity - 2.) / 50.));
let fragColor = max(fragColor - 0.00001, vec4<f32>(0.));
let fragColor2 = fragColor * (exp((iIntensity - 2.) / 50.));
let fragColor3 = max(fragColor2 - 0.00001, vec4<f32>(0.));
let c = textureSample(iInputsTex[0], iSampler, uv) * pow(defaultPulse, 2.);
return max(fragColor, c);
return max(fragColor3, c);
}
+3 -3
View File
@@ -3,14 +3,14 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let n_sides = (iIntensity * 7.) + 2.5;
let whole_sides = floor(n_sides);
let n_sides = fract(n_sides);
let n_sides = whole_sides + smoothstep(0.2, 0.8, n_sides);
let n_sides2 = fract(n_sides);
let n_sides3 = whole_sides + smoothstep(0.2, 0.8, n_sides2);
let xy_cent = 2. * uv - 1.;
let angle_nospin = 2. * abs(atan2(xy_cent.y, xy_cent.x)) / pi;
let angle = abs((10. + 2. * angle_nospin + 0.25 * iTime * iFrequency) % 4. - 2.);
//let angle = abs(atan2(xy_cent.y, xy_cent.x));
let arc = 2. * pi / n_sides;
let arc = 2. * pi / n_sides3;
let a1 = angle_nospin % arc;
//let lengthFactor = sqrt(2.);
let lengthFactor = 1.0;
+4 -4
View File
@@ -15,10 +15,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let amount = iIntensity;
// Avoid the edges to smooth the discontinuity
let amount = amount * smoothstep(0., 0.4, newLightness);
let amount = amount * (1. - smoothstep(0.6, 1., newLightness));
let amount2 = amount * smoothstep(0., 0.4, newLightness);
let amount3 = amount2 * (1. - smoothstep(0.6, 1., newLightness));
let v = mix(v, newLightness, amount);
let rgb = hsv2rgb(vec3<f32>(h, s, v));
let v2 = mix(v, newLightness, amount3);
let rgb = hsv2rgb(vec3<f32>(h, s, v2));
return vec4<f32>(rgb, max(max(max(fragColor.a, rgb.r), rgb.g), rgb.b));
}
+4 -4
View File
@@ -13,8 +13,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let nc_fly = vec2<f32>(nc_spin.x,1.)/abs(nc_spin.y) + vec2<f32>(0., 2.) * iIntensityIntegral;
let nc_tile = abs((0.2 * nc_fly + 21.) % 4. - 2.) - 1.;
let nc_tile = mix(normCoord, nc_tile, smoothstep(0.0, 0.2, iIntensity));
let c = textureSample(iInputsTex[0], iSampler, nc_tile / (2. * aspectCorrection) + 0.5);
let c = c * mix(1., abs(nc_spin.y), smoothstep(0.0, 0.1, iIntensity));
return c;
let nc_tile2 = mix(normCoord, nc_tile, smoothstep(0.0, 0.2, iIntensity));
let c = textureSample(iInputsTex[0], iSampler, nc_tile2 / (2. * aspectCorrection) + 0.5);
let c2 = c * mix(1., abs(nc_spin.y), smoothstep(0.0, 0.1, iIntensity));
return c2;
}
+6 -6
View File
@@ -29,23 +29,23 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let noise_glitch = step(1. - 0.2 * parameter, n1.x);
let white_noise = textureSample(iNoiseTex, iSampler, vec2<f32>(rand3(vec3<f32>(uv, iTime + 100.)), rand3(vec3<f32>(uv, iTime))) % 1.);
let white_noise_rgb = white_noise.rgb * (white_noise.a);
let c = mix(c, vec4<f32>(white_noise_rgb, white_noise.a), noise_glitch);
let c2 = mix(c, vec4<f32>(white_noise_rgb, white_noise.a), noise_glitch);
// Invert colors
let invert_glitch = step(1. - 0.2 * parameter, n1.y);
let c = mix(c, vec4<f32>(c.a - c.rgb, c.a), invert_glitch);
let c3 = mix(c2, vec4<f32>(c2.a - c2.rgb, c2.a), invert_glitch);
// Solid color glitch
let solid_glitch = step(1. - 0.2 * parameter, n1.z);
let c = mix(c, vec4<f32>(0., 1., 0., 1.), solid_glitch);
let c4 = mix(c3, vec4<f32>(0., 1., 0., 1.), solid_glitch);
// Shift glitch
let shift_glitch = step(1. - 0.2 * parameter, n1.w);
let c = mix(c, textureSample(iInputsTex[0], iSampler, uv - vec2<f32>(0.2, 0.)), shift_glitch);
let c5 = mix(c4, textureSample(iInputsTex[0], iSampler, uv - vec2<f32>(0.2, 0.)), shift_glitch);
// Freeze glitch
let freeze_glitch = step(1. - 0.2 * parameter, n2.x);
let c = mix(c, textureSample(iChannelsTex[0], iSampler, uv), freeze_glitch);
let c6 = mix(c5, textureSample(iChannelsTex[0], iSampler, uv), freeze_glitch);
return c;
return c6;
}
+4 -4
View File
@@ -5,9 +5,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let hsv = rgb2hsv(fragColor.rgb);
let h = hsv.x;
let parameter = iIntensity * pow(defaultPulse, 2.);
let h = (h + 4. / 6.) % 1.0 - 3. / 6.;
let h = h * ((1. - parameter / 3.));
let h = (h - 1. / 6.) % 1.0;
let rgb = hsv2rgb(vec3<f32>(h, hsv.yz));
let h2 = (h + 4. / 6.) % 1.0 - 3. / 6.;
let h3 = h2 * ((1. - parameter / 3.));
let h4 = (h3 - 1. / 6.) % 1.0;
let rgb = hsv2rgb(vec3<f32>(h4, hsv.yz));
return vec4<f32>(rgb, max(max(max(fragColor.a, rgb.r), rgb.g), rgb.b));
}
+4 -4
View File
@@ -7,10 +7,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = m;
// x is 1.0 in pure green areas and ~0.0 elsewhere
let m = demultiply(m); // don't use alpha to detect green-ness
let x = pow(clamp(m.g - (m.r + m.b) * 3.0, 0.0, 1.0), 0.2);
let x = x * m.a; // Put alpha back in
let m2 = demultiply(m); // don't use alpha to detect green-ness
let x = pow(clamp(m2.g - (m2.r + m2.b) * 3.0, 0.0, 1.0), 0.2);
let x2 = x * m2.a; // Put alpha back in
let parameter = iIntensity * pow(defaultPulse, 2.);
return composite(fragColor, g * x * parameter);
return composite(fragColor, g * x2 * parameter);
}
+23 -23
View File
@@ -24,18 +24,18 @@ fn grid(basis: mat2x2<f32>, cmykMask: vec4<f32>, uv: vec2<f32>, offset: vec2<f32
let colorCoord = newCoord / points * basis;
let c = textureSample(iInputsTex[0], iSampler, colorCoord / aspectCorrection + 0.5).rgb;
let cmyk = rgb2cmyk(c);
let cmyk = cmyk * (cmykMask);
let cmykValue = dot(cmyk, vec4<f32>(1.));
let r = r * (sqrt(cmykValue));
let cmyk = cmyk / (max(cmykValue, 0.001));
let c = mix(vec3<f32>(1.), cmyk2rgb(cmyk), 1. - smoothstep(r * 0.8, r, length(pt - colorCoord)));
return c;
let cmyk2 = cmyk * (cmykMask);
let cmykValue = dot(cmyk2, vec4<f32>(1.));
let r2 = r * (sqrt(cmykValue));
let cmyk3 = cmyk2 / (max(cmykValue, 0.001));
let c2 = mix(vec3<f32>(1.), cmyk2rgb(cmyk3), 1. - smoothstep(r2 * 0.8, r2, length(pt - colorCoord)));
return c2;
}
fn basis(t: f32) -> mat2x2<f32> {
let t = t * pi / 180.;
return mat2x2(cos(t), sin(t),
-sin(t), cos(t));
let t2 = t * pi / 180.;
return mat2x2(cos(t2), sin(t2),
-sin(t2), cos(t2));
}
fn main(uv: vec2<f32>) -> vec4<f32> {
@@ -55,27 +55,27 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let o3 = vec2<f32>(-c, -s) * 0.25;
let o4 = vec2<f32>(c2, s2) * 0.25;
let c1 = grid(b1, vec4<f32>(1., 0., 0., 0.), uv, o1 + vec2<f32>(0.));
let c1_grid = grid(b1, vec4<f32>(1., 0., 0., 0.), uv, o1 + vec2<f32>(0.));
let m1 = grid(b2, vec4<f32>(0., 1., 0., 0.), uv, o2 + vec2<f32>(0.));
let y1 = grid(b3, vec4<f32>(0., 0., 1., 0.), uv, o3 + vec2<f32>(0.));
let k1 = grid(b4, vec4<f32>(0., 0., 0., 1.), uv, o4 + vec2<f32>(0.));
let c2 = grid(b1, vec4<f32>(1., 0., 0., 0.), uv, o1 + vec2<f32>(0.5));
let c2_grid = grid(b1, vec4<f32>(1., 0., 0., 0.), uv, o1 + vec2<f32>(0.5));
let m2 = grid(b2, vec4<f32>(0., 1., 0., 0.), uv, o2 + vec2<f32>(0.5));
let y2 = grid(b3, vec4<f32>(0., 0., 1., 0.), uv, o3 + vec2<f32>(0.5));
let k2 = grid(b4, vec4<f32>(0., 0., 0., 1.), uv, o4 + vec2<f32>(0.5));
let total = vec3<f32>(1.);
let total = min(total, c1);
let total = min(total, m1);
let total = min(total, y1);
let total = min(total, k1);
let total = min(total, c2);
let total = min(total, m2);
let total = min(total, y2);
let total = min(total, k2);
let total = vec4<f32>(total, 1.);
let total2 = min(total, c1_grid);
let total3 = min(total2, m1);
let total4 = min(total3, y1);
let total5 = min(total4, k1);
let total6 = min(total5, c2_grid);
let total7 = min(total6, m2);
let total8 = min(total7, y2);
let total9 = min(total8, k2);
let total10 = vec4<f32>(total9, 1.);
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let a = max(fragColor.a, max(total.r, max(total.g, total.b)));
let total = vec4<f32>(total.rgb, a);
return mix(fragColor, total, smoothstep(0., 0.1, iIntensity));
let a = max(fragColor.a, max(total10.r, max(total10.g, total10.b)));
let total11 = vec4<f32>(total10.rgb, a);
return mix(fragColor, total11, smoothstep(0., 0.1, iIntensity));
}
+3 -3
View File
@@ -6,9 +6,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
// heart from shadertoy
let normCoord = (uv - 0.5) * aspectCorrection + vec2<f32>(0., 0.15);
let parameter = iIntensity * (1. + 0.5 * pow(defaultPulse, 2.));
let normCoord = normCoord * (2. / parameter);
let a = atan2(normCoord.x, -normCoord.y) / pi;
let r = length(normCoord);
let normCoord2 = normCoord * (2. / parameter);
let a = atan2(normCoord2.x, -normCoord2.y) / pi;
let r = length(normCoord2);
let h = abs(a);
let d = (13.0*h - 22.0*h*h + 10.0*h*h*h) / (6.0 - 5.0 * h);
+2 -2
View File
@@ -4,8 +4,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = (uv - 0.5) * aspectCorrection;
let bs = 256. * pow(2., -9. * iIntensity);
let bs = bs * (0.7 + 0.3 * pow(defaultPulse, 2.));
let bins = bs * aspectCorrection.y;
let bs2 = bs * (0.7 + 0.3 * pow(defaultPulse, 2.));
let bins = bs2 * aspectCorrection.y;
let x = normCoord.x;
let y = round(normCoord.y * bins) / bins;
+4 -4
View File
@@ -2,7 +2,7 @@
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// Modified for Radiance by Eric Van Albert
let MAX_DEPTH = 12;
const MAX_DEPTH: i32 = 12;
fn lookup(coord: vec2<f32>) -> vec4<f32> {
let uv = coord / aspectCorrection + 0.5;
@@ -25,9 +25,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
s += d;
let res = lookup(s);
//let res = smoothstep(0., 1., res); // Makes colors more vibrant
let res = res * (max(res.r, max(res.g, res.b)));
let res = res * (w);
col = composite(col, res);
let res2 = res * (max(res.r, max(res.g, res.b)));
let res3 = res2 * (w);
col = composite(col, res3);
}
return col;
+5 -5
View File
@@ -2,10 +2,10 @@
//#property author https://www.shadertoy.com/view/Xdl3D2
#property frequency 1
let tau = 6.28318530717958647692;
const tau: f32 = 6.28318530717958647692;
// Gamma correction
let GAMMA = 2.2;
const GAMMA: f32 = 2.2;
fn ToLinear(col: vec3<f32>) -> vec3<f32> {
// simulate a monitor, converting colour values into light values
@@ -42,8 +42,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
for ( var i=0; i < 20; i++ )
{
let z = Noise(vec2<i32>(pos.xy)).x;
let z = fract(z - offset);
let d = 50.0 * z - pos.z;
let z2 = fract(z - offset);
let d = 50.0 * z2 - pos.z;
let w = pow(max(0.0, 1.0 - 8.0 * length(fract(pos.xy) - .5)), 2.0);
let c = max(
vec3<f32>(0.),
@@ -52,7 +52,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
1.0 - abs(d - speed2 * .5) / speed
)
);
col += 1.5 * (1.0 - z) * w * c;
col += 1.5 * (1.0 - z2) * w * c;
pos += stp;
}
+2 -2
View File
@@ -3,8 +3,8 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let hsv = rgb2hsv(fragColor.rgb);
let hsv = vec3<f32>(hsv.xy, fragColor.a - hsv.z);
let rgb = mix(fragColor.rgb, hsv2rgb(hsv), iIntensity * pow(defaultPulse, 2.));
let hsv2 = vec3<f32>(hsv.xy, fragColor.a - hsv.z);
let rgb = mix(fragColor.rgb, hsv2rgb(hsv2), iIntensity * pow(defaultPulse, 2.));
let a = max(max(max(fragColor.a, rgb.r), rgb.g), rgb.b);
return vec4<f32>(rgb, a);
}
+4 -4
View File
@@ -37,9 +37,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let h = (1.90 - hsv.x) % 1.0;
let c = colormap(h); // Hue
let c = mix(vec3<f32>(1.0), c.rgb, hsv.y); // Sat
let c = c * hsv.z; // Val
let c = vec4<f32>(c, 1.) * origColor.a;
let c2 = mix(vec3<f32>(1.0), c.rgb, hsv.y); // Sat
let c3 = c2 * hsv.z; // Val
let c4 = vec4<f32>(c3, 1.) * origColor.a;
return mix(origColor, c, iIntensity * pow(defaultPulse, 2.));
return mix(origColor, c4, iIntensity * pow(defaultPulse, 2.));
}
+10 -10
View File
@@ -3,20 +3,20 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = 2. * (uv - 0.5);
let normCoord = normCoord * (aspectCorrection);
let r = length(normCoord);
let theta = atan2(normCoord.y, normCoord.x);
let normCoord2 = normCoord * (aspectCorrection);
let r = length(normCoord2);
let theta = atan2(normCoord2.y, normCoord2.x);
let bins = iIntensity * 5. + 2.;
let tStep = pi / bins;
let theta = abs((theta + 10. * tStep) % (2. * tStep) - tStep);
let theta2 = abs((theta + 10. * tStep) % (2. * tStep) - tStep);
let theta = theta + (iTime * iFrequency * pi * 0.125) % pi;
let theta3 = theta2 + (iTime * iFrequency * pi * 0.125) % pi;
let newUV = r * vec2<f32>(cos(theta), sin(theta));
let newUV = newUV * (0.707);
let newUV = newUV / (aspectCorrection);
let newUV = newUV * 0.5 + 0.5;
let newUV = r * vec2<f32>(cos(theta3), sin(theta3));
let newUV2 = newUV * (0.707);
let newUV3 = newUV2 / (aspectCorrection);
let newUV4 = newUV3 * 0.5 + 0.5;
return textureSample(iInputsTex[0], iSampler, mix(uv, newUV, smoothstep(0., 0.2, iIntensity)));
return textureSample(iInputsTex[0], iSampler, mix(uv, newUV4, smoothstep(0., 0.2, iIntensity)));
}
+2 -2
View File
@@ -11,9 +11,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
fn distFn(x: vec4<f32>, y: vec4<f32>) -> f32 {
let v = demultiply(x).xyz - demultiply(y).xyz;
let v = abs(v);
let v2 = abs(v);
//float d = v.x + v.y + v.z;
let d = length(v);
let d = length(v2);
return d;
//return 1. / (0.0001 + d);
}
+11 -11
View File
@@ -3,28 +3,28 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = 2. * (uv - 0.5);
let normCoord = normCoord * (aspectCorrection);
let normCoord2 = normCoord * (aspectCorrection);
// Look up r and theta
let r = length(normCoord);
let theta = atan2(normCoord.y, normCoord.x);
let r = length(normCoord2);
let theta = atan2(normCoord2.y, normCoord2.x);
// Image is sampled along a vertical line that slowly shifts back and forth
// and this line is then swept into a circle
// Get two newUVs, one for the top half and one for the bottom half
let newUV1 = vec2<f32>(sin(iTime * iFrequency * 0.5 * pi), r);
let newUV2 = vec2<f32>(sin(iTime * iFrequency * 0.5 * pi), -r);
let newUV1 = newUV1 / (aspectCorrection);
let newUV1 = newUV1 * 0.5 + 0.5;
let newUV2 = newUV2 / (aspectCorrection);
let newUV2 = newUV2 * 0.5 + 0.5;
let newUV1a = newUV1 / (aspectCorrection);
let newUV1b = newUV1a * 0.5 + 0.5;
let newUV2a = newUV2 / (aspectCorrection);
let newUV2b = newUV2a * 0.5 + 0.5;
// Make them both converge to the old UV at low intensity so that identity holds
let newUV1 = mix(uv, newUV1, smoothstep(0., 0.3, iIntensity));
let newUV2 = mix(uv, newUV2, smoothstep(0., 0.3, iIntensity));
let newUV1c = mix(uv, newUV1b, smoothstep(0., 0.3, iIntensity));
let newUV2c = mix(uv, newUV2b, smoothstep(0., 0.3, iIntensity));
let c1 = textureSample(iInputsTex[0], iSampler, newUV1);
let c2 = textureSample(iInputsTex[0], iSampler, newUV2);
let c1 = textureSample(iInputsTex[0], iSampler, newUV1c);
let c2 = textureSample(iInputsTex[0], iSampler, newUV2c);
// Mix them based on angle
return mix(c2, c1, smoothstep(-0.5, 0.5, sin(theta)));
+22 -22
View File
@@ -4,8 +4,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let alive = textureSample(iChannelsTex[1], iSampler, uv).r;
let under = textureSample(iInputsTex[0], iSampler, uv);
let over = alive * textureSample(iChannelsTex[2], iSampler, uv);
let over = over * (smoothstep(0., 0.2, iIntensity));
return composite(under, over);
let over2 = over * (smoothstep(0., 0.2, iIntensity));
return composite(under, over2);
}
#buffershader
@@ -17,38 +17,38 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let bs = max((1. - iIntensity) / (2.3 * onePixel.x), 5.);
let bins = bs * aspectCorrection;
let db = 1. / (bins * aspectCorrection);
let normCoord = round(normCoord * bins) * db + 0.5;
let normCoord2 = round(normCoord * bins) * db + 0.5;
let n = 0.;
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>(-1., -1.)).r);
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>(-1., 0.)).r);
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>(-1., 1.)).r);
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>( 0., -1.)).r);
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>( 0., 1.)).r);
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>( 1., -1.)).r);
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>( 1., 0.)).r);
let n = n + (textureSample(iChannelsTex[1], iSampler, normCoord + db * vec2<f32>( 1., 1.)).r);
let s = textureSample(iChannelsTex[1], iSampler, normCoord).r;
let n2 = n + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>(-1., -1.)).r);
let n3 = n2 + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>(-1., 0.)).r);
let n4 = n3 + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>(-1., 1.)).r);
let n5 = n4 + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>( 0., -1.)).r);
let n6 = n5 + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>( 0., 1.)).r);
let n7 = n6 + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>( 1., -1.)).r);
let n8 = n7 + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>( 1., 0.)).r);
let n9 = n8 + (textureSample(iChannelsTex[1], iSampler, normCoord2 + db * vec2<f32>( 1., 1.)).r);
let s = textureSample(iChannelsTex[1], iSampler, normCoord2).r;
// Use bright areas of the source image to help "birth" pixels (or kill)
let source = textureSample(iInputsTex[0], iSampler, normCoord) * pow(defaultPulse, 2.);
let source = textureSample(iInputsTex[0], iSampler, normCoord2) * pow(defaultPulse, 2.);
//float r = 20. * rand(vec3<f32>(normCoord, iTime)) + mix(4.0, 0, iIntensity);
//float bonus = step(20.5, r + max(max(source.r, source.g), source.b));
//let n = //n + (bonus * 3);
// if (s == 0) { alive = (n == 3) }
// else { alive = (2 <= n <= 3) }
let alive = step(1.8, n) * step(n, 3.2) * step(2.8, n + s);
let alive = alive * step(0.05, iIntensity); // to reset
// if (s == 0) { alive = (n9 == 3) }
// else { alive = (2 <= n9 <= 3) }
let alive = step(1.8, n9) * step(n9, 3.2) * step(2.8, n9 + s);
let alive2 = alive * step(0.05, iIntensity); // to reset
// Make there be life if there is sufficient input color
//float lifeFromInput = step(0.5, smoothstep(0., 3., dot(vec3<f32>(1.), source.rgb)));
let lifeFromInput = step(0.8, max(source.r, max(source.g, source.b)));
let alive = max(alive, lifeFromInput);
let alive = alive * step(0.01, textureSample(iChannelsTex[2], iSampler, normCoord).a); // Kill stable life if there is no color
let alive3 = max(alive2, lifeFromInput);
let alive4 = alive3 * step(0.01, textureSample(iChannelsTex[2], iSampler, normCoord2).a); // Kill stable life if there is no color
return vec4<f32>(alive, 1., 1., 1.);
return vec4<f32>(alive4, 1., 1., 1.);
}
#buffershader
@@ -59,7 +59,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
fn main(uv: vec2<f32>) -> vec4<f32> {
let oldC = textureSample(iChannelsTex[2], iSampler, uv);
let d = mix(0.01, 0.001, iIntensity);
let oldC = max(oldC - d, vec4<f32>(0.));
let oldC2 = max(oldC - d, vec4<f32>(0.));
let newC = textureSample(iInputsTex[0], iSampler, uv);
return max(oldC, newC);
return max(oldC2, newC);
}
+6 -6
View File
@@ -2,18 +2,18 @@
fn triGrid(basis: mat2x2<f32>, uv: vec2<f32>) -> vec4<f32> {
let points = min(3. / iIntensity, 10000.);
let points = points / (0.3 + 0.7 * pow(defaultPulse, 2.));
let r = 0.5 / points;
let points2 = points / (0.3 + 0.7 * pow(defaultPulse, 2.));
let r = 0.5 / points2;
let invBasis = inverse2(basis);
let pt = (uv - 0.5) * aspectCorrection;
let newCoord = round(pt * points * invBasis);
let colorCoord = newCoord / points * basis;
let newCoord = round(pt * points2 * invBasis);
let colorCoord = newCoord / points2 * basis;
let c = textureSample(iInputsTex[0], iSampler, colorCoord / aspectCorrection + 0.5);
let c = c * (1. - step(r, length(pt - colorCoord)));
return c;
let c2 = c * (1. - step(r, length(pt - colorCoord)));
return c2;
}
fn main(uv: vec2<f32>) -> vec4<f32> {
+7 -7
View File
@@ -16,22 +16,22 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let NOBULGE_HEIGHT = 0.01;
let angle_t = (2. + angle / pi + iTime * iFrequency * BULGE_SPEED) % 2.0 - 1.0;
let bulge = exp(-pow(angle_t / BULGE_WIDTH, 2.)) * BULGE_HEIGHT;
let bulge = bulge + (NOBULGE_HEIGHT);
let bulge2 = bulge + (NOBULGE_HEIGHT);
// Compute distance from circle, including bulge & standing wave
let CIRCLE_R = mix(0.10, 0.40, iIntensity); //0.33
let WAVE_COUNT = 16.;
let WAVE_SPEED = 1. / 4.0;
let d = abs(r - CIRCLE_R - bulge * sin(angle * WAVE_COUNT - iTime * pi * WAVE_SPEED));
let d = abs(r - CIRCLE_R - bulge2 * sin(angle * WAVE_COUNT - iTime * pi * WAVE_SPEED));
// Turn distance into alpha
// Turn distance into alpha
let THICKNESS = mix(0.07, 0.12, iAudioLow); // 0.10
let alpha = max(0.0, 1.0 - 10. * d);
let alpha = max(0., cos(min(1.8, (1.0 - alpha) / THICKNESS)));
let alpha2 = max(0., cos(min(1.8, (1.0 - alpha) / THICKNESS)));
// Composite purple onto input
let color = vec4<f32>(0.8, 0.1, 0.9, 1.0);
let color = color * (alpha);
let color = color * (smoothstep(0.0, 0.1, iIntensity));
return composite(originalColor, color);
let color2 = color * (alpha2);
let color3 = color2 * (smoothstep(0.0, 0.1, iIntensity));
return composite(originalColor, color3);
}
+7 -7
View File
@@ -4,8 +4,8 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let c = textureSample(iChannelsTex[1], iSampler, uv);
let c = c * (smoothstep(0., 0.2, iIntensity));
return composite(fragColor, c);
let c2 = c * (smoothstep(0., 0.2, iIntensity));
return composite(fragColor, c2);
}
#buffershader
@@ -14,13 +14,13 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let c1 = textureSample(iInputsTex[0], iSampler, uv);
let perturb = sin(uv.yx * 10. + sin(vec2<f32>(iTime * iFrequency * 0.5, iTime * iFrequency * 0.75))); // Perturb a little to make the melting more wavy
let perturb = perturb * (1. - smoothstep(0., 0.1, uv.y)); // Don't perturb near the top to avoid going off-texture
let perturb2 = perturb * (1. - smoothstep(0., 0.1, uv.y)); // Don't perturb near the top to avoid going off-texture
let c2 = textureSample(iChannelsTex[1], iSampler, uv + vec2<f32>(0., -0.01 * iIntensity) + 0.005 * iIntensity * perturb);
let c2 = textureSample(iChannelsTex[1], iSampler, uv + vec2<f32>(0., -0.01 * iIntensity) + 0.005 * iIntensity * perturb2);
let fragColor = max(c1, c2); // Blend between the current frame and a slightly shifted down version of it using the max function
let fragColor = max(fragColor - 0.002 - 0.02 * (1. - iIntensity), vec4<f32>(0.)); // Fade it out slightly
let fragColor2 = max(fragColor - 0.002 - 0.02 * (1. - iIntensity), vec4<f32>(0.)); // Fade it out slightly
let fragColor = fragColor * smoothstep(0., 0.1, iIntensity); // Clear back buffer when intensity is low
return fragColor;
let fragColor3 = fragColor2 * smoothstep(0., 0.1, iIntensity); // Clear back buffer when intensity is low
return fragColor3;
}
+2 -2
View File
@@ -3,6 +3,6 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let xPos = (1. - smoothstep(0., 0.2, iIntensity)) * 0.5 + 0.5;
let x = -abs(uv.x - xPos) + xPos;
let x = x + (iIntensity * 0.5 * pow(defaultPulse, 2.));
return textureSample(iInputsTex[0], iSampler, vec2<f32>(x, uv.y));
let x2 = x + (iIntensity * 0.5 * pow(defaultPulse, 2.));
return textureSample(iInputsTex[0], iSampler, vec2<f32>(x2, uv.y));
}
+4 -3
View File
@@ -1,9 +1,10 @@
#property description Fill frame with NANs or INFs
fn main(uv: vec2<f32>) -> vec4<f32> {
let nan = 0. / 0.;
let n_inf = -1. / 0.;
let p_inf = 1. / 0.;
let zero = 0.0;
let nan = zero / zero;
let n_inf = -1. / zero;
let p_inf = 1. / zero;
if iIntensity < 0.25 {
return textureSampleLevel(iInputsTex[0], iSampler, uv, 0.);
+13 -13
View File
@@ -8,22 +8,22 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let x = normCoord.x;
let wave = 0.;
let wave = wave + 0.6 * sin(x * 10. + iTime * 1.) * iAudioLow;
let wave = wave + 0.6 * sin(x * 15. + iTime * -0.3) * iAudioLow;
let wave = wave + 0.2 * sin(x * 40. + iTime * 8.) * iAudioMid;
let wave = wave + 0.2 * sin(x * 70. + iTime * -3.) * iAudioLow;
let wave = wave + 0.1 * sin(x * 120. + iTime * 16.) * iAudioHi;
let wave = wave + 0.1 * sin(x * 180. + iTime * -10.) * iAudioHi;
let wave = wave * iAudioLevel;
let wave = wave * smoothstep(0., 0.3, iIntensity);
let wave = wave * (0.5 + 0.5 * pow(defaultPulse, 2.));
let wave2 = wave + 0.6 * sin(x * 10. + iTime * 1.) * iAudioLow;
let wave3 = wave2 + 0.6 * sin(x * 15. + iTime * -0.3) * iAudioLow;
let wave4 = wave3 + 0.2 * sin(x * 40. + iTime * 8.) * iAudioMid;
let wave5 = wave4 + 0.2 * sin(x * 70. + iTime * -3.) * iAudioLow;
let wave6 = wave5 + 0.1 * sin(x * 120. + iTime * 16.) * iAudioHi;
let wave7 = wave6 + 0.1 * sin(x * 180. + iTime * -10.) * iAudioHi;
let wave8 = wave7 * iAudioLevel;
let wave9 = wave8 * smoothstep(0., 0.3, iIntensity);
let wave10 = wave9 * (0.5 + 0.5 * pow(defaultPulse, 2.));
let d = abs(normCoord.y - wave);
let d = abs(normCoord.y - wave10);
let glow = 1. - smoothstep(0., (0.02 + iAudioHi * 0.3) * smoothstep(0., 0.5, iIntensity), d);
let glow = glow + (0.5 * (1. - smoothstep(0., (0.3 + iAudioHi * 0.3) * iIntensity, d)));
let glow = glow * (0.7 + 0.3 * pow(defaultPulse, 0.5));
let c = vec4<f32>(0., 1., 0., 1.) * glow;
let glow2 = glow + (0.5 * (1. - smoothstep(0., (0.3 + iAudioHi * 0.3) * iIntensity, d)));
let glow3 = glow2 * (0.7 + 0.3 * pow(defaultPulse, 0.5));
let c = vec4<f32>(0., 1., 0., 1.) * glow3;
return composite(fragColor, c);
}
+17 -17
View File
@@ -6,27 +6,27 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let o = vec3<f32>(-1., 0., 1.);
let gx = vec4<f32>(0.0);
let gy = vec4<f32>(0.0);
let gx = gx + textureSample(iInputsTex[0], iSampler, uv + o.xz * onePixel);
let gy = gy + gx;
let gx = gx + 2.0*textureSample(iInputsTex[0], iSampler, uv + o.xy * onePixel);
let gx2 = gx + textureSample(iInputsTex[0], iSampler, uv + o.xz * onePixel);
let gy2 = gy + gx2;
let gx3 = gx2 + 2.0*textureSample(iInputsTex[0], iSampler, uv + o.xy * onePixel);
let t = textureSample(iInputsTex[0], iSampler, uv + o.xx * onePixel);
let gx = gx + t;
let gy = gy - t;
let gy = gy + 2.0*textureSample(iInputsTex[0], iSampler, uv + o.yz * onePixel);
let gy = gy - 2.0*textureSample(iInputsTex[0], iSampler, uv + o.yx * onePixel);
let t = textureSample(iInputsTex[0], iSampler, uv + o.zz * onePixel);
let gx = gx - t;
let gy = gy + t;
let gx = gx - 2.0*textureSample(iInputsTex[0], iSampler, uv + o.zy * onePixel);
let t = textureSample(iInputsTex[0], iSampler, uv + o.zx * onePixel);
let gx = gx - t;
let gy = gy - t;
let grad = sqrt(gx * gx + gy * gy);
let gx4 = gx3 + t;
let gy3 = gy2 - t;
let gy4 = gy3 + 2.0*textureSample(iInputsTex[0], iSampler, uv + o.yz * onePixel);
let gy5 = gy4 - 2.0*textureSample(iInputsTex[0], iSampler, uv + o.yx * onePixel);
let t2 = textureSample(iInputsTex[0], iSampler, uv + o.zz * onePixel);
let gx5 = gx4 - t2;
let gy6 = gy5 + t2;
let gx6 = gx5 - 2.0*textureSample(iInputsTex[0], iSampler, uv + o.zy * onePixel);
let t3 = textureSample(iInputsTex[0], iSampler, uv + o.zx * onePixel);
let gx7 = gx6 - t3;
let gy7 = gy6 - t3;
let grad = sqrt(gx7 * gx7 + gy7 * gy7);
let black = clamp(1.0 - length(grad) * 0.9, 0., 1.);
let black = pow(black, mix(1.0, 2.0, iIntensity));
let black2 = pow(black, mix(1.0, 2.0, iIntensity));
let c = textureSample(iInputsTex[0], iSampler, uv);
let rgb = c.rgb * (mix(1.0, black, iIntensity * pow(defaultPulse, 2.)));
let rgb = c.rgb * (mix(1.0, black2, iIntensity * pow(defaultPulse, 2.)));
return add_alpha(rgb, c.a);
}
+3 -3
View File
@@ -14,7 +14,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let parameter = iIntensity * (0.7 + 0.3 * pow(defaultPulse, 2.));
let c = vec4<f32>(1., 0.5, 0.5, 1.0);
let c = c * (1. - smoothstep(r - smooth_amt, r, length((count + normCoord * 5. * parameter + 0.5) % vec2<f32>(1.) - 0.5)));
let c = c * smoothstep(0., 0.1, iIntensity);
return composite(fragColor, c);
let c2 = c * (1. - smoothstep(r - smooth_amt, r, length((count + normCoord * 5. * parameter + 0.5) % vec2<f32>(1.) - 0.5)));
let c3 = c2 * smoothstep(0., 0.1, iIntensity);
return composite(fragColor, c3);
}
+4 -4
View File
@@ -4,11 +4,11 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = (uv - 0.5) * aspectCorrection;
let bs = 256. * pow(2., -9. * iIntensity);
let bs = bs * (0.7 + 0.3 * pow(defaultPulse, 2.));
let bins = bs * aspectCorrection;
let normCoord = round(normCoord * bins) / bins;
let bs2 = bs * (0.7 + 0.3 * pow(defaultPulse, 2.));
let bins = bs2 * aspectCorrection;
let normCoord2 = round(normCoord * bins) / bins;
let newUV = normCoord / aspectCorrection + 0.5;
let newUV = normCoord2 / aspectCorrection + 0.5;
return textureSample(iInputsTex[0], iSampler, newUV);
}
+2 -2
View File
@@ -8,7 +8,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
//let lengthFactor = 1.0;
let newUV = vec2<f32>(length(normCoord) / lengthFactor, abs(((atan2(normCoord.x, -normCoord.y) / pi + 1. + 0.25 * iTime * iFrequency) % 2.) - 1.)) - 0.5;
let newUV = newUV / aspectCorrection + 0.5;
let newUV2 = newUV / aspectCorrection + 0.5;
return textureSample(iInputsTex[0], iSampler, mix(uv, newUV, iIntensity));
return textureSample(iInputsTex[0], iSampler, mix(uv, newUV2, iIntensity));
}
+2 -2
View File
@@ -5,11 +5,11 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let n_sides = clamp(2.4 / (1. - iIntensity), 3., 10000.);
let whole_sides = floor(n_sides);
let fract_sides = fract(n_sides);
let n_sides = whole_sides + smoothstep(0.2, 0.8, fract_sides);
let n_sides2 = whole_sides + smoothstep(0.2, 0.8, fract_sides);
let normCoord = 2. * (uv - 0.5) * aspectCorrection;
let angle = atan2(normCoord.y, normCoord.x);
let arc = 2. * pi / n_sides;
let arc = 2. * pi / n_sides2;
let a1 = (abs(angle) + iFrequency * iTime * 0.25 * arc) % arc;
//let lengthFactor = sqrt(2.);
let lengthFactor = 1.0;
+2 -2
View File
@@ -7,8 +7,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let rgba = demultiply(textureSample(iInputsTex[0], iSampler, uv));
let hsv = rgb2hsv(rgba.rgb);
let h = (round(hsv.r * bins) / bins) % 1.0;
let hsv = vec3<f32>(h, hsv.yz);
let rgb = hsv2rgb(hsv);
let hsv2 = vec3<f32>(h, hsv.yz);
let rgb = hsv2rgb(hsv2);
return premultiply(vec4<f32>(rgb, rgba.a));
}
+3 -3
View File
@@ -6,8 +6,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
// bin in non-premultiplied space, then re-premultiply
let c = demultiply(textureSample(iInputsTex[0], iSampler, uv));
let c = round(c * bins) / bins;
let c = clamp(c, vec4<f32>(0.0), vec4<f32>(1.0));
let fragColor = premultiply(c);
let c2 = round(c * bins) / bins;
let c3 = clamp(c2, vec4<f32>(0.0), vec4<f32>(1.0));
let fragColor = premultiply(c3);
return mix(textureSample(iInputsTex[0], iSampler, uv), fragColor, pow(defaultPulse, 2.));
}
+4 -4
View File
@@ -1,6 +1,6 @@
#property description Projector light scattering
let DEPTH = 200;
const DEPTH: i32 = 200;
fn lookup(coord: vec2<f32>) -> vec4<f32> {
let texUV = coord / aspectCorrection + 0.5;
@@ -17,9 +17,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
w *= 0.98;
let s = (normCoord - source) / (f32(i) / f32(DEPTH)) + source;
let res = lookup(s);
let res = res * (max(res.r, max(res.g, res.b)));
let res = res * (w);
col = composite(col, res);
let res2 = res * (max(res.r, max(res.g, res.b)));
let res3 = res2 * (w);
col = composite(col, res3);
}
return col;
+6 -6
View File
@@ -5,14 +5,14 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = (uv - 0.5) * aspectCorrection;
let t = iTime * iFrequency * pi / 4.;
let center = vec2<f32>(sin(t), cos(t));
let center = center * (0.5);
let center2 = center * (0.5);
let a = clamp(length(center - normCoord), 0., 1.);
let a = pow(a, 2.);
let a = 1.0 - a;
let a = a * (iIntensity);
let a = clamp(length(center2 - normCoord), 0., 1.);
let a2 = pow(a, 2.);
let a3 = 1.0 - a2;
let a4 = a3 * (iIntensity);
let c = vec4<f32>(0.2, 0.1, 0.5, 1.) * a;
let c = vec4<f32>(0.2, 0.1, 0.5, 1.) * a4;
return composite(textureSample(iInputsTex[0], iSampler, uv), c);
}
+7 -7
View File
@@ -1,7 +1,7 @@
#property description Rainbow radial blur
#property frequency 1
let DEPTH = 16;
const DEPTH: i32 = 16;
fn lookup(coord: vec2<f32>) -> vec4<f32> {
return textureSample(iInputsTex[0], iSampler, coord / aspectCorrection + 0.5);
@@ -20,19 +20,19 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
s += d;
let res = lookup(s);
//let res = smoothstep(0., 1., res); // Makes colors more vibrant
let res = res * max(res.r, max(res.g, res.b));
let res = res * w;
let hsv = rgb2hsv(res.rgb); // TODO this would probably be made much faster using a buffershader of the input converted to HSV
let res2 = res * max(res.r, max(res.g, res.b));
let res3 = res2 * w;
let hsv = rgb2hsv(res3.rgb); // TODO this would probably be made much faster using a buffershader of the input converted to HSV
let h = fract(hsv.x + f32(i) * deltaHue - 0.5 * iTime * iFrequency);
let rgb = hsv2rgb(vec3<f32>(h, hsv.yz));
col = composite(col, add_alpha(rgb, res.a));
col = composite(col, add_alpha(rgb, res3.a));
}
// This composition results in some saturation loss,
// so resaturate
let hsv = rgb2hsv(col.rgb);
let s = pow(hsv.y, (1.5 - pow(iIntensity, 0.5)) / 1.5);
let rgb = hsv2rgb(vec3<f32>(hsv.x, s, hsv.z));
let s_final = pow(hsv.y, (1.5 - pow(iIntensity, 0.5)) / 1.5);
let rgb = hsv2rgb(vec3<f32>(hsv.x, s_final, hsv.z));
return add_alpha(rgb, col.a);
}
+2 -2
View File
@@ -11,6 +11,6 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let rgb = hsv2rgb(vec3<f32>(h, hsv.yz));
let c = add_alpha(rgb, fragColor.a);
let fragColor = mix(fragColor, c, iIntensity);
return select(c, mix(fragColor, c, iIntensity), iFrequency != 0.);
let fragColor2 = mix(fragColor, c, iIntensity);
return select(c, mix(fragColor2, c, iIntensity), iFrequency != 0.);
}
+4 -4
View File
@@ -14,10 +14,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let rot = mat2x2<f32>(c, -s, s, c);
let newUV = normCoord * rot;
let newUV = newUV / aspectCorrection + 0.5;
let newUV2 = newUV / aspectCorrection + 0.5;
let nc = textureSample(iInputsTex[0], iSampler, newUV);
let nc = nc * (box(newUV));
let nc = textureSample(iInputsTex[0], iSampler, newUV2);
let nc2 = nc * (box(newUV2));
return nc;
return nc2;
}
+4 -4
View File
@@ -2,7 +2,7 @@
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// Modified for Radiance by Eric Van Albert
let DEPTH = 64;
const DEPTH: i32 = 64;
fn lookup(coord: vec2<f32>) -> vec4<f32> {
return textureSample(iInputsTex[0], iSampler, coord / aspectCorrection + 0.5);
@@ -20,9 +20,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
s += d;
let res = lookup(s);
//let res = smoothstep(0., 1., res); // Makes colors more vibrant
let res = res * (max(res.r, max(res.g, res.b)));
let res = res * (w);
col = composite(col, res);
let res2 = res * (max(res.r, max(res.g, res.b)));
let res3 = res2 * (w);
col = composite(col, res3);
}
return col;
+5 -5
View File
@@ -2,7 +2,7 @@
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// Modified for Radiance by Eric Van Albert
let DEPTH = 64;
const DEPTH: i32 = 64;
fn lookup(coord: vec2<f32>) -> vec4<f32> {
return textureSample(iInputsTex[0], iSampler, coord / aspectCorrection + 0.5);
@@ -19,10 +19,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
w *= .99;
s += d;
let res = lookup(s);
//let res = smoothstep(0., 1., res); // Makes colors more vibrant
let res = res * (max(res.r, max(res.g, res.b)));
let res = res * (w);
col = composite(col, res);
//let res2 = smoothstep(0., 1., res); // Makes colors more vibrant
let res2 = res * (max(res.r, max(res.g, res.b)));
let res3 = res2 * (w);
col = composite(col, res3);
}
return col;
+4 -4
View File
@@ -6,9 +6,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let over = textureSample(iChannelsTex[1], iSampler, uv);
let a = step(1. - iIntensity + 0.005, over.a);
let over = over * a;
let over2 = over * a;
return composite(under, over);
return composite(under, over2);
}
#buffershader
@@ -16,7 +16,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
fn main(uv: vec2<f32>) -> vec4<f32> {
let before = textureSample(iChannelsTex[1], iSampler, uv);
let a = max(before.a - 0.005, 0.);
let before = before * a;
let before2 = before * a;
let transVec = textureSample(iChannelsTex[2], iSampler, vec2<f32>(0.));
let trans = step(0.5, transVec.r - transVec.g) + step(0., -iFrequency);
@@ -33,7 +33,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let color = clamp(vec4<f32>(hsv2rgb(hsv), 1.0), vec4<f32>(0.0), vec4<f32>(1.0));
let inside = box((uv - xy) / wh + 0.5) * trans;
return mix(before, color, inside);
return mix(before2, color, inside);
}
#buffershader
+3 -3
View File
@@ -5,8 +5,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let factor = pow(iIntensity, 0.6);
let noise_input = vec3<f32>(uv, iTime * iFrequency / 8.);
let n = noise3(noise_input) - 0.1;
let n = n + (noise3(2. * noise_input) - 0.5) * 0.5;
let n = n + (noise3(4. * noise_input) - 0.5) * 0.25;
let n2 = n + (noise3(2. * noise_input) - 0.5) * 0.5;
let n3 = n2 + (noise3(4. * noise_input) - 0.5) * 0.25;
//let n = mod(n + 0.5, 1.0);
//let n = mod(n + hsl.r, 1.0);
@@ -14,7 +14,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let hsl = rgb2hsv(samp.rgb);
let s = 1.0 - (1.0 - hsl.g) * (1.0 - factor);
//let hsl.r = mix(hsl.r, n, iIntensity);
let h = fract(hsl.r + n * iIntensity);
let h = fract(hsl.r + n3 * iIntensity);
let l = hsl.b;
return add_alpha(hsv2rgb(vec3<f32>(h, s, l)), samp.a);
}
+12 -12
View File
@@ -9,26 +9,26 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let wave = 0.;
// As long as all of the multiplicitive factors on "a"
// are integers, there will be no discontinuities
let wave = wave + 0.24 * sin(a * 5. + iTime * 1.) * iAudioLow;
let wave = wave + 0.24 * sin(a * 7. + iTime * -0.3) * iAudioLow;
let wave = wave + 0.06 * sin(a * 40. + iTime * 8.) * iAudioMid;
let wave = wave + 0.06 * sin(a * 70. + iTime * -3.) * iAudioLow;
let wave = wave + 0.03 * sin(a * 120. + iTime * 16.) * iAudioHi;
let wave = wave + 0.03 * sin(a * 180. + iTime * -10.) * iAudioHi;
let wave = wave * iAudioLevel;
let wave = wave * iIntensity;
let wave = wave * defaultPulse;
let wave2 = wave + 0.24 * sin(a * 5. + iTime * 1.) * iAudioLow;
let wave3 = wave2 + 0.24 * sin(a * 7. + iTime * -0.3) * iAudioLow;
let wave4 = wave3 + 0.06 * sin(a * 40. + iTime * 8.) * iAudioMid;
let wave5 = wave4 + 0.06 * sin(a * 70. + iTime * -3.) * iAudioLow;
let wave6 = wave5 + 0.03 * sin(a * 120. + iTime * 16.) * iAudioHi;
let wave7 = wave6 + 0.03 * sin(a * 180. + iTime * -10.) * iAudioHi;
let wave8 = wave7 * iAudioLevel;
let wave9 = wave8 * iIntensity;
let wave10 = wave9 * defaultPulse;
// Avoid discontinuities in the center
let wave = wave * (smoothstep(0., 0.2, l));
let wave11 = wave10 * (smoothstep(0., 0.2, l));
// Avoid going past the edges
let extra = 0.5 * (aspectCorrection - 1.);
let edgeFadeOut = (1. - smoothstep(0.4 + extra, 0.5 + extra, abs(normCoord)));
let wave = wave * edgeFadeOut.x * edgeFadeOut.y;
let wave12 = wave11 * edgeFadeOut.x * edgeFadeOut.y;
// Move radially by "wave" amount
let offset = normalize(normCoord) * wave;
let offset = normalize(normCoord) * wave12;
return textureSample(iInputsTex[0], iSampler, (normCoord + offset) / aspectCorrection + 0.5);
}
+4 -4
View File
@@ -10,8 +10,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let f = m.a * iIntensity * defaultPulse;
let fragColor = vec4<f32>(mix(m.rgb, vec3<f32>(0.0), f), m.a);
let fragColor = composite(fragColor, r * m.r * f);
let fragColor = composite(fragColor, g * m.g * f);
let fragColor = composite(fragColor, b * m.b * f);
return fragColor;
let fragColor2 = composite(fragColor, r * m.r * f);
let fragColor3 = composite(fragColor2, g * m.g * f);
let fragColor4 = composite(fragColor3, b * m.b * f);
return fragColor4;
}
+2 -2
View File
@@ -6,10 +6,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let t = iTime * iFrequency;
let deviation = (2. * floor(t)) % 8. / 8.;
let deviation = deviation * (clamp(iIntensity / 0.8, 0., 1.));
let deviation2 = deviation * (clamp(iIntensity / 0.8, 0., 1.));
let hsv = rgb2hsv(fragColor.rgb);
let h = fract(hsv.r + 1. + deviation);
let h = fract(hsv.r + 1. + deviation2);
let rgb = hsv2rgb(vec3<f32>(h, hsv.yz));
return add_alpha(rgb, fragColor.a);
}
+2 -2
View File
@@ -8,6 +8,6 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let new_ = textureSample(iInputsTex[0], iSampler, uv);
let dist = abs(uv.y - yv); // TODO: make this wrap around
let fragColor = mix(old, new_, max(0., 1.0 - (1. / iStep) * (0.1 * rate) * dist));
let fragColor = mix(new_, fragColor, pow(iIntensity, 0.1));
return fragColor;
let fragColor2 = mix(new_, fragColor, pow(iIntensity, 0.1));
return fragColor2;
}
+3 -3
View File
@@ -4,9 +4,9 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = (uv - 0.5) * aspectCorrection;
let r = iIntensity;
let r = r * ((sawtooth(iTime * iFrequency / 2.0, 0.5) - 0.5) * 2.);
let s = sin(r * pi);
let c = cos(r * pi);
let r2 = r * ((sawtooth(iTime * iFrequency / 2.0, 0.5) - 0.5) * 2.);
let s = sin(r2 * pi);
let c = cos(r2 * pi);
let rot = mat2x2<f32>(c, -s, s, c);
let newUV = normCoord * rot / aspectCorrection + 0.5;
+8 -8
View File
@@ -10,10 +10,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
fn pixelate(xy: vec2<f32>, n_buckets: f32) -> vec2<f32> {
let xy_buckets = n_buckets * aspectCorrection;
let xy = xy - 0.5;
let xy = round(xy * xy_buckets) / xy_buckets;
let xy = xy + 0.5;
return xy;
let xy2 = xy - 0.5;
let xy3 = round(xy2 * xy_buckets) / xy_buckets;
let xy4 = xy3 + 0.5;
return xy4;
}
fn in_bucket(uv: vec2<f32>, xy: vec2<f32>, n_buckets: f32) -> bool{
@@ -25,13 +25,13 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let n_buckets = 10.;
let left = vec2<f32>(rand2(vec2<f32>(iTime, 0.)), rand2(vec2<f32>(iTime, 1.)));
let left = pixelate(left, n_buckets);
let left2 = pixelate(left, n_buckets);
let right = vec2<f32>(rand2(vec2<f32>(iTime, 2.)), rand2(vec2<f32>(iTime, 3.)));
let right = pixelate(right, n_buckets);
let right2 = pixelate(right, n_buckets);
var newColor = textureSample(iChannelsTex[1], iSampler, uv);
if (in_bucket(uv, left, n_buckets)) {
let newCoord = uv - left + right;
if (in_bucket(uv, left2, n_buckets)) {
let newCoord = uv - left2 + right2;
let oldDist = distance(newColor.xy, uv);
let newDist = distance(newCoord, uv);
let improvement = oldDist - newDist; // positive means reverting to normal
+2 -2
View File
@@ -4,7 +4,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let hsv = rgb2hsv(fragColor.rgb);
let h = max((iIntensity - 0.1) / 0.9, 0.);
let hsv = vec3<f32>(h, hsv.yz);
let rgb = mix(fragColor.rgb, hsv2rgb(hsv), smoothstep(0., 0.1, iIntensity) * defaultPulse);
let hsv2 = vec3<f32>(h, hsv.yz);
let rgb = mix(fragColor.rgb, hsv2rgb(hsv2), smoothstep(0., 0.1, iIntensity) * defaultPulse);
return add_alpha(rgb, fragColor.a);
}
+6 -6
View File
@@ -5,14 +5,14 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let deviation = iTime * iFrequency * 0.5 - 0.5;
let uv2 = (uv - 0.5) * aspectCorrection;
let x = abs((uv2.x + deviation + 1.5) % 2. - 1.) - 0.5;
let uv2 = vec2<f32>(x, uv2.y);
let uv2 = uv2 / aspectCorrection + 0.5;
let uv3 = vec2<f32>(x, uv2.y);
let uv4 = uv3 / aspectCorrection + 0.5;
let oc = textureSample(iInputsTex[0], iSampler, uv);
let c = textureSample(iInputsTex[0], iSampler, uv2);
let c = textureSample(iInputsTex[0], iSampler, uv4);
let oc = oc * (1. - smoothstep(0.1, 0.2, iIntensity));
let c = c * smoothstep(0., 0.1, iIntensity);
let oc2 = oc * (1. - smoothstep(0.1, 0.2, iIntensity));
let c2 = c * smoothstep(0., 0.1, iIntensity);
return composite(oc, c);
return composite(oc2, c2);
}
+6 -6
View File
@@ -7,13 +7,13 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let noise_input = vec3<f32>(normCoord * iIntensity * 4., iIntensity + iIntensityIntegral * iFrequency);
let n = noise3(noise_input) - 0.1;
let n = n + ((noise3(2. * noise_input) - 0.5) * 0.5);
let n = n + ((noise3(4. * noise_input) - 0.5) * 0.25);
let n = n + ((noise3(8. * noise_input) - 0.5) * 0.125);
let n = n + ((noise3(16. * noise_input) - 0.5) * 0.0625);
let n = n / 3.;
let n2 = n + ((noise3(2. * noise_input) - 0.5) * 0.5);
let n3 = n2 + ((noise3(4. * noise_input) - 0.5) * 0.25);
let n4 = n3 + ((noise3(8. * noise_input) - 0.5) * 0.125);
let n5 = n4 + ((noise3(16. * noise_input) - 0.5) * 0.0625);
let n6 = n5 / 3.;
let a = clamp(n * n * 5., 0., 1.) * smoothstep(0., 0.2, iIntensity);
let a = clamp(n6 * n6 * 5., 0., 1.) * smoothstep(0., 0.2, iIntensity);
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
return composite(fragColor, vec4<f32>(0., a, 0., a));
+13 -13
View File
@@ -3,9 +3,9 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let c = textureSample(iChannelsTex[1], iSampler, uv); // The smoke is stored and drawn on iChannelsTex[1]
let c = c * (smoothstep(0., 0.2, iIntensity));
let fragColor = composite(c, fragColor);
return fragColor;
let c2 = c * (smoothstep(0., 0.2, iIntensity));
let fragColor2 = composite(c2, fragColor);
return fragColor2;
}
#buffershader
@@ -23,8 +23,8 @@ fn circulate(uv: vec2<f32>, xf: mat3x3<f32>) -> vec2<f32> {
let val = 0.01 * pt * mat2x2<f32>(0., 1., -1., 0.) / (l * l);
// Prevent weirdness in the center
let val = val * (smoothstep(0., 0.1, l));
return val;
let val2 = val * (smoothstep(0., 0.1, l));
return val2;
}
// Create a compelling circulating vector field
@@ -49,8 +49,8 @@ fn vectorField(uv: vec2<f32>) -> vec2<f32> {
}
// Give a slight bit of divergence
let field = field - ((uv - 0.5) * iIntensity * iIntensity * 0.3);
return field;
let field2 = field - ((uv - 0.5) * iIntensity * iIntensity * 0.3);
return field2;
}
fn main(uv: vec2<f32>) -> vec4<f32> {
@@ -63,17 +63,17 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iChannelsTex[1], iSampler, uv + vectorField(uv) * dt);
// Fade out
let fragColor = fragColor * exp((iIntensity - 2.) * fadeout / 3.);
let fragColor2 = fragColor * exp((iIntensity - 2.) * fadeout / 3.);
// Clear when intensity is zero
let fragColor = fragColor * smoothstep(0., 0.1, iIntensity);
let fragColor3 = fragColor2 * smoothstep(0., 0.1, iIntensity);
// Desaturate
let avgRGB = (fragColor.r + fragColor.g + fragColor.b) / 3.;
let rgb = mix(fragColor.rgb, vec3<f32>(avgRGB), 0.05);
let fragColor = vec4<f32>(rgb, fragColor.a);
let avgRGB = (fragColor3.r + fragColor3.g + fragColor3.b) / 3.;
let rgb = mix(fragColor3.rgb, vec3<f32>(avgRGB), 0.05);
let fragColor4 = vec4<f32>(rgb, fragColor3.a);
// Composite with input
let c = textureSample(iInputsTex[0], iSampler, uv);
return composite(fragColor, c);
return composite(fragColor4, c);
}
+5 -5
View File
@@ -11,12 +11,12 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let phase = iTime * iFrequency / 32.;
let xy = vec2<f32>(sawtooth(phase * 5.0, 0.5), abs(sin(phase * 9.0 * pi)));
let xy = (xy - 0.5) * (1.0 - scale);
let uvSample = (uv - 0.5 + xy) / scale + 0.5;
let xy2 = (xy - 0.5) * (1.0 - scale);
let uvSample = (uv - 0.5 + xy2) / scale + 0.5;
let c = textureSample(iInputsTex[0], iSampler, uvSample);
//let c = vec4<f32>(c.rgb, mix(c.a, 1., iIntensity)); // onblack
let c = c * box(uvSample);
//let c2 = vec4<f32>(c.rgb, mix(c.a, 1., iIntensity)); // onblack
let c2 = c * box(uvSample);
let under = textureSample(iChannelsTex[0], iSampler, uv) * smoothstep(0., 0.1, iIntensity);
return composite(under, c);
return composite(under, c2);
}
+3 -3
View File
@@ -2,9 +2,9 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iChannelsTex[0], iSampler, uv);
var fragColor = fragColor * (exp(-iIntensity / 20.));
var fragColor2 = fragColor * (exp(-iIntensity / 20.));
if (rand3(vec3<f32>(uv, iTime)) < exp(-iIntensity * 3.) * sawtooth(iTime * iFrequency, 0.9)) {
fragColor = textureSampleLevel(iInputsTex[0], iSampler, uv, 1.);
fragColor2 = textureSampleLevel(iInputsTex[0], iSampler, uv, 1.);
}
return fragColor;
return fragColor2;
}
+5 -5
View File
@@ -12,12 +12,12 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let rot = mat2x2<f32>(c, -s, s, c);
let newUV = normCoord * rot / aspectCorrection;
let newUV = newUV * min(iResolution.x, iResolution.y) / max(iResolution.x, iResolution.y);
let newUV = newUV + 0.5;
let newUV2 = newUV * min(iResolution.x, iResolution.y) / max(iResolution.x, iResolution.y);
let newUV3 = newUV2 + 0.5;
let oc = textureSample(iInputsTex[0], iSampler, uv);
let nc = textureSample(iInputsTex[0], iSampler, newUV);
let nc = nc * box(newUV);
let nc = textureSample(iInputsTex[0], iSampler, newUV3);
let nc2 = nc * box(newUV3);
return mix(oc, nc, smoothstep(0., 0.5, iIntensity));
return mix(oc, nc2, smoothstep(0., 0.5, iIntensity));
}
+6 -9
View File
@@ -15,20 +15,20 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let td = fract(t * 4.0);
let tw = floor(t * 4.0);
let td = tw + smoothstep(0., 1., td);
let td = td / (2.0);
let td2 = tw + smoothstep(0., 1., td);
let td3 = td2 / (2.0);
// t with detent
//let t = mix(t, td, 0.97);
let q = step(fract(t + 0.25), 0.5);
let q = min(q, step(0.5 - dw * 0.5, x));
let q = max(q, step(0.5 + dw * 0.5, x));
let q2 = min(q, step(0.5 - dw * 0.5, x));
let q3 = max(q2, step(0.5 + dw * 0.5, x));
let theta = t * pi;
let uvNorm = (uv - 0.5) * scale * aspectCorrection;
let r1 = fract(uvNorm);
let r2 = fract(uvNorm + vec2<f32>(0.5));
let rep = mix(r1, r2, q);
let rep = mix(r1, r2, q3);
let off = (rep - vec2<f32>(0.5, 0.5)) * 2.0;
let s = sin(theta);
@@ -40,11 +40,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let d = 1.0 / sqrt(2.0) * min(1.0, 2.0 * ((1.0 + dw / 2.0) * (0.5 - abs(x - 0.5))));
let v = smoothstep(d - eps, d + eps, max(abs(xy.x), abs(xy.y)));
let left = vec4<f32>(1.0, 1.0, 1.0, 1.0);
let right = vec4<f32>(0.0, 0.0, 0.0, 1.0);
let left = textureSample(iInputsTex[0], iSampler, uv);
let right = textureSample(iInputsTex[1], iSampler, uv);
return mix(right, left, abs(q - v));
return mix(right, left, abs(q3 - v));
}
+2 -2
View File
@@ -3,7 +3,7 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let xc = iIntensity;
let color = vec4<f32>(1.0, 1.0, 1.0, 1.0);
let color = color * (1. - step(0.5 * onePixel.x, abs(xc - uv.x)));
let color2 = color * (1. - step(0.5 * onePixel.x, abs(xc - uv.x)));
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
return composite(fragColor, color);
return composite(fragColor, color2);
}
+6 -6
View File
@@ -3,19 +3,19 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let fragColor = textureSample(iInputsTex[0], iSampler, uv);
let c = textureSample(iChannelsTex[1], iSampler, uv);
let c = c * smoothstep(0., 0.2, iIntensity);
return composite(fragColor, c);
let c2 = c * smoothstep(0., 0.2, iIntensity);
return composite(fragColor, c2);
}
#buffershader
fn main(uv: vec2<f32>) -> vec4<f32> {
let delta = iStep * iFrequency;
let uvSample = (uv - 0.5) * (1.0 - delta) + 0.5;
let fragColor = textureSample(iChannelsTex[1], iSampler, clamp(uvSample, vec2<f32>(0.), vec2<f32>(1.)));
let fragColor = fragColor * exp(-1. / 30.);
let fragColor = select(fragColor, vec4<f32>(0.), fragColor.r < 0.02);
let fragColor2 = fragColor * exp(-1. / 30.);
let fragColor3 = select(fragColor2, vec4<f32>(0.), fragColor2.r < 0.02);
let random = rand4(textureSample(iNoiseTex, iSampler, uv) * iTime);
let random2 = rand4(textureSample(iNoiseTex, iSampler, uv) * iTime + 100.);
let thresh = exp((iIntensity - 2.) * 4.);
let fragColor = select(fragColor, vec4<f32>(1.), random < thresh && random2 < thresh);
return fragColor;
let fragColor4 = select(fragColor3, vec4<f32>(1.), random < thresh && random2 < thresh);
return fragColor4;
}
+8 -8
View File
@@ -6,8 +6,8 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let hold = textureSample(iChannelsTex[1], iSampler, uv);
let inp = textureSample(iInputsTex[0], iSampler, uv);
let hold = vec4<f32>(hold.rgb, 1.) * inp.a;
return mix(inp, hold, iIntensity);
let hold2 = vec4<f32>(hold.rgb, 1.) * inp.a;
return mix(inp, hold2, iIntensity);
}
#buffershader
@@ -19,12 +19,12 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let k = hold.a;
let d = distance(inp.rgb, hold.rgb) / sqrt(3.);
let k = k + pow(d, 0.5) * 0.3 - 0.03;
let k = k * pow(iIntensity, 0.3);
let k = k + pow(defaultPulse, 0.5); // I don't really get whats going on here
let k = clamp(k, 0., 1.);
let k2 = k + pow(d, 0.5) * 0.3 - 0.03;
let k3 = k2 * pow(iIntensity, 0.3);
let k4 = k3 + pow(defaultPulse, 0.5); // I don't really get whats going on here
let k5 = clamp(k4, 0., 1.);
let rgb = mix(inp.rgb, hold.rgb, k);
let a = k;
let rgb = mix(inp.rgb, hold.rgb, k5);
let a = k5;
return vec4<f32>(rgb, a);
}
+28 -28
View File
@@ -13,49 +13,49 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
// Sample perlin noise with many octaves
let n = noise3(noise_input) - 0.1;
let n = n + (noise3(2. * noise_input) - 0.5) * 0.5;
let n = n + (noise3(4. * noise_input) - 0.5) * 0.25;
let n = n + (noise3(8. * noise_input) - 0.5) * 0.125;
let n = n + (noise3(16. * noise_input) - 0.5) * 0.0625;
let n2 = n + (noise3(2. * noise_input) - 0.5) * 0.5;
let n3 = n2 + (noise3(4. * noise_input) - 0.5) * 0.25;
let n4 = n3 + (noise3(8. * noise_input) - 0.5) * 0.125;
let n5 = n4 + (noise3(16. * noise_input) - 0.5) * 0.0625;
// Take the noise and create "ridges", call it `a`
let n = n - 0.5;
let n = n * mix(20.0, -4., iAudioLevel);
let n = clamp(abs(n), 0., 1.);
let n = 1.0 - pow(n, mix(1.0, 4.0, iAudioLevel));
let a = n;
let n6 = n5 - 0.5;
let n7 = n6 * mix(20.0, -4., iAudioLevel);
let n8 = clamp(abs(n7), 0., 1.);
let n9 = 1.0 - pow(n8, mix(1.0, 4.0, iAudioLevel));
let a = n9;
// Sample perlin noise with just a few octaves, we'll use it for color
let noise_input = noise_input + vec3<f32>(0., 0., 1337.);
let n = noise3(noise_input) - 0.1;
let n = n + ((noise3(2. * noise_input) - 0.5) * 0.5);
let n = n + ((noise3(4. * noise_input) - 0.5) * 0.25);
let n = clamp(n, 0., 1.);
let n = pow(n, 2.0);
let b = n;
let noise_input2 = noise_input + vec3<f32>(0., 0., 1337.);
let n10 = noise3(noise_input2) - 0.1;
let n11 = n10 + ((noise3(2. * noise_input2) - 0.5) * 0.5);
let n12 = n11 + ((noise3(4. * noise_input2) - 0.5) * 0.25);
let n13 = clamp(n12, 0., 1.);
let n14 = pow(n13, 2.0);
let b = n14;
// Sample perlin noise for distortion
let noise_input = noise_input + vec3<f32>(0., 0., 9876.);
let n = noise3(noise_input) - 0.1;
let n = n + (noise3(2. * noise_input) - 0.5) * 0.5;
let n = n + (noise3(4. * noise_input) - 0.5) * 0.25;
let n = n + (noise3(8. * noise_input) - 0.5) * 0.125;
let noise_input3 = noise_input2 + vec3<f32>(0., 0., 9876.);
let n15 = noise3(noise_input3) - 0.1;
let n16 = n15 + (noise3(2. * noise_input3) - 0.5) * 0.5;
let n17 = n16 + (noise3(4. * noise_input3) - 0.5) * 0.25;
let n18 = n17 + (noise3(8. * noise_input3) - 0.5) * 0.125;
// Mix the new noise with `a` to create fringing around the tentacles
let c = n * mix(0.08, 0.4, a);
let c = n18 * mix(0.08, 0.4, a);
// Distort (re-use `b` as angle)
let uvNew = uv;
let uNew = uvNew.x + (cos(b) * c);
let vNew = uvNew.y + (sin(b) * c);
let uvNew = mix(uv, vec2<f32>(uNew, vNew), iIntensity);
let uvNew = clamp(uvNew, vec2<f32>(0.), vec2<f32>(1.));
let uvNew2 = mix(uv, vec2<f32>(uNew, vNew), iIntensity);
let uvNew3 = clamp(uvNew2, vec2<f32>(0.), vec2<f32>(1.));
// Make a black-ish/blue-ish color
let color = vec4<f32>(0.05, 0.4, 0.5, 1.);
let color_rgb = color.rgb * b;
let color_rg = color_rgb.rg * (mix(0.7, 1.0, c));
let color = vec4<f32>(color_rg, color_rgb.b, color.a);
let color = color * a * smoothstep(0., 0.2, iIntensity);
let color2 = vec4<f32>(color_rg, color_rgb.b, color.a);
let color3 = color2 * a * smoothstep(0., 0.2, iIntensity);
let under = textureSample(iInputsTex[0], iSampler, uvNew);
return composite(under, color);
let under = textureSample(iInputsTex[0], iSampler, uvNew3);
return composite(under, color3);
}
+5 -5
View File
@@ -2,15 +2,15 @@
#property frequency 1
fn main(uv: vec2<f32>) -> vec4<f32> {
let xv = round(uv.x * 20. * aspectCorrection.x);
let xv = round(uv.x * 20. * aspectCorrection.x);
let fragColor = textureSample(iChannelsTex[0], iSampler, uv);
let fragColor = fragColor * (exp(-iIntensity * iFrequency / 20.));
let fragColor2 = fragColor * (exp(-iIntensity * iFrequency / 20.));
let fragColor = select(
fragColor,
let fragColor3 = select(
fragColor2,
textureSample(iInputsTex[0], iSampler, uv),
rand2(vec2<f32>(xv, iTime)) < exp(-iIntensity * 4.)
);
return fragColor;
return fragColor3;
}
+6 -6
View File
@@ -4,10 +4,10 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let pt = (uv - 0.5) * aspectCorrection;
let op = onePixel * 0.3;
let factor = exp(-6. * iIntensity);
let factor = factor / (0.7 + 0.3 * pow(defaultPulse, 2.));
let factor2 = factor / (0.7 + 0.3 * pow(defaultPulse, 2.));
let coord = floor(pt * factor / op) * op;
let f = fract(pt * factor / op);
let coord = floor(pt * factor2 / op) * op;
let f = fract(pt * factor2 / op);
let c = textureSample(iInputsTex[0], iSampler, coord + 0.5);
let redSubpixel = box(vec2<f32>(0.0, 0.) + f * vec2<f32>(3.6, 1.2)) * vec4<f32>(c.r, 0., 0., c.r);
@@ -15,7 +15,7 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let blueSubpixel = box(vec2<f32>(-2.4, 0.) + f * vec2<f32>(3.6, 1.2)) * vec4<f32>(0., 0., c.b, c.b);
let c2 = redSubpixel + greenSubpixel + blueSubpixel;
let fragColor = textureSample(iInputsTex[0], iSampler, (uv - 0.5) * factor + 0.5);
let fragColor = mix(fragColor, c2, smoothstep(0.3, 0.6, iIntensity));
return fragColor;
let fragColor = textureSample(iInputsTex[0], iSampler, (uv - 0.5) * factor2 + 0.5);
let fragColor2 = mix(fragColor, c2, smoothstep(0.3, 0.6, iIntensity));
return fragColor2;
}
+3 -3
View File
@@ -13,8 +13,8 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let w = 1. - iIntensity;
let x = select(0., pow(0.5 - t, 3.0), t < 0.5);
let factor = min(factor, 1.0 - x);
let factor = clamp(factor, 0.0, 1.0);
let factor2 = min(factor, 1.0 - x);
let factor3 = clamp(factor2, 0.0, 1.0);
return mix(next, prev, factor);
return mix(next, prev, factor3);
}
+4 -4
View File
@@ -3,8 +3,8 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = uv - 0.5;
let bins = pow(2., 4. * iIntensity);
let bins = bins / (mix(1., (0.7 + 0.3 * pow(defaultPulse, 2.)), smoothstep(0., 0.2, iIntensity)));
let newUV = normCoord * bins;
let newUV = abs((newUV + 1.5 + 10.) % 2. - 1.) - 0.5;
return textureSample(iInputsTex[0], iSampler, newUV + 0.5);
let bins2 = bins / (mix(1., (0.7 + 0.3 * pow(defaultPulse, 2.)), smoothstep(0., 0.2, iIntensity)));
let newUV = normCoord * bins2;
let newUV2 = abs((newUV + 1.5 + 10.) % 2. - 1.) - 0.5;
return textureSample(iInputsTex[0], iSampler, newUV2 + 0.5);
}
+8 -8
View File
@@ -8,15 +8,15 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
// White outline
let c = vec4<f32>(1.);
let c = c * (1. - smoothstep(r - 0.1, r, length(normCoord)));
let out_c = composite(out_c, c);
/// Red and green (sampled from buffer shader)
let c = textureSample(iChannelsTex[1], iSampler, (uv - 0.5) / r + 0.5);
let c = c * (1. - smoothstep(r - 0.2, r - 0.1, length(normCoord)));
let out_c = composite(out_c, c);
let c2 = c * (1. - smoothstep(r - 0.1, r, length(normCoord)));
let out_c2 = composite(out_c, c2);
return out_c;
/// Red and green (sampled from buffer shader)
let c3 = textureSample(iChannelsTex[1], iSampler, (uv - 0.5) / r + 0.5);
let c4 = c3 * (1. - smoothstep(r - 0.2, r - 0.1, length(normCoord)));
let out_c3 = composite(out_c2, c4);
return out_c3;
}
#buffershader
+3 -3
View File
@@ -3,10 +3,10 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let baseImage = textureSample(iInputsTex[0], iSampler, uv);
let sep = iIntensity * ((baseImage.r + baseImage.g + baseImage.b) * 0.2 + 0.4) * 0.05;
let sep = sep * (pow(defaultPulse, 0.5));
let sep2 = sep * (pow(defaultPulse, 0.5));
let redImage = textureSample(iInputsTex[0], iSampler, uv + vec2<f32>(sep, 0.));
let blueImage = textureSample(iInputsTex[0], iSampler, uv - vec2<f32>(sep, 0.));
let redImage = textureSample(iInputsTex[0], iSampler, uv + vec2<f32>(sep2, 0.));
let blueImage = textureSample(iInputsTex[0], iSampler, uv - vec2<f32>(sep2, 0.));
let r = mix(baseImage.r, redImage.r, 0.9);
let g = mix(baseImage.g, blueImage.g, 0.3);
+4 -4
View File
@@ -3,9 +3,9 @@
fn main(uv: vec2<f32>) -> vec4<f32> {
let normCoord = uv - 0.5;
let bins = pow(2., 4. * iIntensity);
let bins = bins / (mix(1., (0.7 + 0.3 * pow(defaultPulse, 2.)), smoothstep(0., 0.2, iIntensity)));
let newUV = normCoord * bins;
let newUV = fract(newUV + 0.5) - 0.5;
let fragColor = textureSample(iInputsTex[0], iSampler, newUV + 0.5);
let bins2 = bins / (mix(1., (0.7 + 0.3 * pow(defaultPulse, 2.)), smoothstep(0., 0.2, iIntensity)));
let newUV = normCoord * bins2;
let newUV2 = fract(newUV + 0.5) - 0.5;
let fragColor = textureSample(iInputsTex[0], iSampler, newUV2 + 0.5);
return fragColor;
}
+6 -6
View File
@@ -7,20 +7,20 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
let t2 = iFrequency * iTime * (pi / 16.);
let offset = vec2<f32>(sin(t2), cos(t2)) * iFrequency * 0.1;
let q = q - (offset);
let q2 = q - (offset);
let len = length(q);
let len = length(q2);
let t = iFrequency * iTime;
let a = 6. * atan2(q.y, q.x) / (2. * pi) + t * 0.3;
let b = 6. * atan2(q.y, q.x) / (2. * pi) + t * 0.3;
let a = 6. * atan2(q2.y, q2.x) / (2. * pi) + t * 0.3;
let b = 6. * atan2(q2.y, q2.x) / (2. * pi) + t * 0.3;
let r1 = 0.3 / len + t * 0.5;
let r2 = 0.2 / len + t * 0.5;
let texcoords = vec2<f32>(a + 0.1 / len, r1);
let texcoords = abs(fract(texcoords * 0.5) * 2. - 1.);
let texcoords2 = abs(fract(texcoords * 0.5) * 2. - 1.);
let fragColor = textureSample(iInputsTex[0], iSampler, mix(uv, texcoords, iIntensity));
let fragColor = textureSample(iInputsTex[0], iSampler, mix(uv, texcoords2, iIntensity));
return fragColor * (smoothstep(0., 0.1 * iIntensity, len));
}
+2 -2
View File
@@ -19,6 +19,6 @@ fn main(uv: vec2<f32>) -> vec4<f32> {
+ map.br * bound(2.0, 3.0, 0.20, t)
+ map.gr * bound(1.0, 2.0, 0.20, tOff);
let newUV = mix(uv, newUV, iIntensity * map.a);
return textureSample(iInputsTex[0], iSampler, newUV);
let newUV2 = mix(uv, newUV, iIntensity * map.a);
return textureSample(iInputsTex[0], iSampler, newUV2);
}

Some files were not shown because too many files have changed in this diff Show More