summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gpu/demo_effects.h10
-rw-r--r--workspaces/main/pop_punk_drums.track12
-rw-r--r--workspaces/main/shaders/chroma_aberration.wgsl12
-rw-r--r--workspaces/main/shaders/gaussian_blur.wgsl16
4 files changed, 31 insertions, 19 deletions
diff --git a/src/gpu/demo_effects.h b/src/gpu/demo_effects.h
index a9258af..72c8e6e 100644
--- a/src/gpu/demo_effects.h
+++ b/src/gpu/demo_effects.h
@@ -88,11 +88,13 @@ class ParticleSprayEffect : public Effect {
// Parameters for GaussianBlurEffect (set at construction time)
struct GaussianBlurParams {
- float strength = 2.0f; // Default: 2.0 pixel blur radius
- float _pad = 0.0f;
+ float strength = 1.0f; // Default
+ float strength_audio = 0.5f; // how much to pulse with audio
+ float stretch = 1.f; // y/x axis ratio
+ float _pad = 0.;
};
-static_assert(sizeof(GaussianBlurParams) == 8,
- "GaussianBlurParams must be 8 bytes for WGSL alignment");
+static_assert(sizeof(GaussianBlurParams) == 16,
+ "GaussianBlurParams must be 16 bytes for WGSL alignment");
class GaussianBlurEffect : public PostProcessEffect {
public:
diff --git a/workspaces/main/pop_punk_drums.track b/workspaces/main/pop_punk_drums.track
index 6f8e653..f54bf9d 100644
--- a/workspaces/main/pop_punk_drums.track
+++ b/workspaces/main/pop_punk_drums.track
@@ -98,9 +98,19 @@ PATTERN break LENGTH 1.0
0.6250, ASSET_KICK_1, 0.9, 0.0
0.7500, ASSET_KICK_1, 0.9, 0.0
-# Score: 4-bar sequence
+# Score
SCORE
0.0, main_groove_crash # Bar 1: with crash
1.0, main_groove # Bar 2
2.0, main_groove # Bar 3
3.0, break # Bar 4: transition
+
+ 4.0, main_groove_crash # Bar 1: with crash
+ 5.0, main_groove # Bar 2
+ 6.0, main_groove # Bar 3
+ 7.0, break # Bar 4: transition
+
+ 8.0, main_groove_crash # Bar 1: with crash
+ 9.0, main_groove # Bar 2
+ 10.0, main_groove # Bar 3
+ 11.0, break # Bar 4: transition
diff --git a/workspaces/main/shaders/chroma_aberration.wgsl b/workspaces/main/shaders/chroma_aberration.wgsl
index ee730b1..d5e50ea 100644
--- a/workspaces/main/shaders/chroma_aberration.wgsl
+++ b/workspaces/main/shaders/chroma_aberration.wgsl
@@ -15,14 +15,10 @@ struct ChromaAberrationParams {
@fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> {
let uv = p.xy / uniforms.resolution;
- // Compute offset magnitude and direction
- let offset_mag = params.offset_scale * uniforms.audio_intensity;
- let offset_dir = vec2<f32>(cos(params.angle), sin(params.angle));
- let offset = offset_mag * offset_dir;
-
- // Sample RGB channels with chromatic aberration
+ let amp = params.offset_scale * uniforms.audio_intensity;
+ let offset = amp * vec2<f32>(cos(params.angle), sin(params.angle));
+ let center = textureSample(txt, smplr, uv);
let r = textureSample(txt, smplr, uv + offset).r;
- let g = textureSample(txt, smplr, uv).g;
let b = textureSample(txt, smplr, uv - offset).b;
- return vec4<f32>(r, g, b, 1.0);
+ return vec4<f32>(r, center.g, b, 1.0);
}
diff --git a/workspaces/main/shaders/gaussian_blur.wgsl b/workspaces/main/shaders/gaussian_blur.wgsl
index 22e467f..4e845ff 100644
--- a/workspaces/main/shaders/gaussian_blur.wgsl
+++ b/workspaces/main/shaders/gaussian_blur.wgsl
@@ -1,3 +1,5 @@
+// 5x5 gaussian blur
+
@group(0) @binding(0) var smplr: sampler;
@group(0) @binding(1) var txt: texture_2d<f32>;
@@ -6,6 +8,8 @@
struct GaussianBlurParams {
strength: f32,
+ strength_audio: f32,
+ stretch: f32, // dir_y / dir_x
_pad: f32,
};
@@ -13,17 +17,17 @@ struct GaussianBlurParams {
@group(0) @binding(3) var<uniform> params: GaussianBlurParams;
@fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> {
- let uv = p.xy / uniforms.resolution;
- var res = vec4<f32>(0.0);
-
// Parameterized strength + dramatic beat pulsation
- let pulse = 0.5 + uniforms.audio_intensity * 2.0; // Pulsate between 0.5x and 2.5x with beat
+ let pulse = 1.0 + uniforms.audio_intensity * params.strength_audio; // Pulsate beat
let size = params.strength * pulse;
+ let dir = vec2<f32>(1., params.stretch) * size / uniforms.resolution.x;
+ let uv = p.xy / uniforms.resolution;
+ var res = vec4<f32>(0.0);
for (var x: f32 = -2.0; x <= 2.0; x += 1.0) {
for (var y: f32 = -2.0; y <= 2.0; y += 1.0) {
- res += textureSample(txt, smplr, uv + vec2<f32>(x, y) * size / uniforms.resolution.x);
+ res += textureSample(txt, smplr, uv + vec2<f32>(x, y) * dir);
}
}
- return res / 25.0;
+ return res * (1. / 25.0);
}