shader fix
This commit is contained in:
@@ -35,7 +35,7 @@ struct U {
|
||||
p3: vec4<f32>, // grain, glitch_a, fog, beat
|
||||
p4: vec4<f32>, // loud, low, mid, high
|
||||
p5: vec4<f32>, // stutter_w, swirl, aspect, tonality
|
||||
col2: vec4<f32>, // accent2.rgb (secondary neon), _
|
||||
col2: vec4<f32>, // accent2.rgb (secondary neon), release
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> u: U;
|
||||
@@ -141,8 +141,10 @@ fn fs_main(in: VsOut) -> @location(0) vec4<f32> {
|
||||
let swirl = u.p5.y; // accumulated swirl angle (rad)
|
||||
let aspect = u.p5.z;
|
||||
let tonal = u.p5.w;
|
||||
let release = u.col2.w;
|
||||
|
||||
// --- hi-band glitch grid: coarse-cell UV displacement of the FEEDBACK
|
||||
// --- hi-band glitch grid
|
||||
// : coarse-cell UV displacement of the FEEDBACK
|
||||
// sample only — the bulb itself stays geometrically stable so a busy hat
|
||||
// pattern can't tear the whole picture. Deadband below 0.35 so quiet
|
||||
// music produces no glitch at all; only a small fraction of cells shove
|
||||
@@ -166,12 +168,11 @@ fn fs_main(in: VsOut) -> @location(0) vec4<f32> {
|
||||
let uv = in.uv;
|
||||
let ndc = vec2<f32>(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0);
|
||||
let dist = u.cam.w;
|
||||
let focal = 1.6;
|
||||
let focal = 1.6 + 0.4 * release * release; // FOV warp on drop
|
||||
let ro = vec3<f32>(0.0, 0.0, -dist);
|
||||
let rd = normalize(vec3<f32>(ndc.x * aspect, ndc.y, focal));
|
||||
|
||||
// Ray vs bounding sphere — the background-pixel early-out that keeps the
|
||||
// raymarch from melting the GPU. `rb` is set to (scale + breath + pad).
|
||||
// Ray vs bounding sphere
|
||||
let b = dot(ro, rd);
|
||||
let c = dot(ro, ro) - rb * rb;
|
||||
let disc = b * b - c;
|
||||
@@ -234,12 +235,11 @@ fn fs_main(in: VsOut) -> @location(0) vec4<f32> {
|
||||
// zero, only strong snares light the edge.
|
||||
body = body + accent2 * highf * highf * fres * fres * 0.40;
|
||||
}
|
||||
// Particle-dither: per-pixel hash threshold against intensity.
|
||||
// Each pixel is a "particle" that either shows or doesn't —
|
||||
// identifies the form as point-cloud rather than solid surface.
|
||||
// Particle-dither: less hectic in quiet parts
|
||||
let dither_thresh = clamp(inten * 2.2 - 0.08, 0.0, 1.0);
|
||||
let pcell = hash21(uv * vec2<f32>(res_w, res_h) * 0.85
|
||||
+ vec2<f32>(frame * 0.013, frame * 0.029));
|
||||
let pkeep = step(pcell, clamp(inten * 1.65 + 0.12, 0.0, 1.0));
|
||||
let pkeep = step(pcell, dither_thresh);
|
||||
col = body * inten * (0.50 + 0.55 * pkeep);
|
||||
// Core punch — uses the per-pixel tint so the bulb's deep core
|
||||
// glows different shades in different regions, not one hot dot.
|
||||
|
||||
Reference in New Issue
Block a user