diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-16 09:43:06 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-16 09:43:06 +0100 |
| commit | 766c0b0a41ddb4ac1fae68f720a9176a1b5f6070 (patch) | |
| tree | b8530354de7133c7828d177889a6a4eb1d0570ba /common/shaders/combined_postprocess_v2.wgsl | |
| parent | 04938fc4a3335e1459e5fb23d0d091fd2a40c296 (diff) | |
feat(sequence): add inline post-process functions for v2
- Create postprocess_inline.wgsl with 7 inline effect functions
- Functions: vignette, flash, fade, theme, solarize, chroma_aberration, distort
- Add example combined_postprocess_v2.wgsl showing usage
- Register postprocess_inline snippet with ShaderComposer
- Add to main and test workspace assets
- All tests passing (36/36)
Strategy: Simple effects become inline functions instead of separate classes.
Complex effects (rotating_cube, hybrid_3d, particles) remain as TODO for v2 port.
handoff(Claude): Inline functions ready, 7 simple effects consolidated
Diffstat (limited to 'common/shaders/combined_postprocess_v2.wgsl')
| -rw-r--r-- | common/shaders/combined_postprocess_v2.wgsl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/common/shaders/combined_postprocess_v2.wgsl b/common/shaders/combined_postprocess_v2.wgsl new file mode 100644 index 0000000..a934dce --- /dev/null +++ b/common/shaders/combined_postprocess_v2.wgsl @@ -0,0 +1,36 @@ +// Example: Combined post-process using inline functions +// Demonstrates how to chain multiple simple effects without separate classes + +#include "sequence_v2_uniforms" +#include "postprocess_inline" + +@group(0) @binding(0) var input_sampler: sampler; +@group(0) @binding(1) var input_texture: texture_2d<f32>; +@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams; + +struct VertexOutput { + @builtin(position) position: vec4<f32>, + @location(0) uv: vec2<f32>, +}; + +@vertex fn vs_main(@builtin(vertex_index) vid: u32) -> VertexOutput { + var out: VertexOutput; + let x = f32((vid & 1u) << 1u); + let y = f32((vid & 2u)); + out.position = vec4<f32>(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); + out.uv = vec2<f32>(x, y); + return out; +} + +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { + // Sample base color + var color = textureSample(input_texture, input_sampler, in.uv); + + // Apply effects in sequence (customize as needed) + // color = apply_solarize(color, 0.4, 0.4, uniforms.time); + // color = apply_theme(color, vec3<f32>(1.0, 0.8, 0.6), 0.3); + color = apply_vignette(color, in.uv, 0.6, 0.1, uniforms.audio_intensity); + // color = apply_flash(color, uniforms.beat_phase * 0.2); + + return color; +} |
