summaryrefslogtreecommitdiff
path: root/assets/final/shaders/solarize.wgsl
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-04 22:08:56 +0100
committerskal <pascal.massimino@gmail.com>2026-02-04 22:08:56 +0100
commitdd9d3013d260f27f86b268c203a290f91431d8e5 (patch)
tree7ca8bb5e4c2eb2bff3736992e899e6ce676c6234 /assets/final/shaders/solarize.wgsl
parent91933ce05ba157dc549d52ed6c00c71c457fca05 (diff)
feat: Optional sequence end times and comprehensive effect documentation
This milestone implements several key enhancements to the sequencing system and developer documentation: ## Optional Sequence End Times (New Feature) - Added support for explicit sequence termination via [time] syntax - Example: SEQUENCE 0 0 [30.0] forcefully ends all effects at 30 seconds - Updated seq_compiler.cc to parse optional [time] parameter with brackets - Added end_time_ field to Sequence class (default -1.0 = no explicit end) - Modified update_active_list() to check sequence end time and deactivate all effects when reached - Fully backward compatible - existing sequences work unchanged ## Comprehensive Effect Documentation (demo.seq) - Documented all effect constructor parameters (standard: device, queue, format) - Added runtime parameter documentation (time, beat, intensity, aspect_ratio) - Created detailed effect catalog with specific behaviors: * Scene effects: HeptagonEffect, ParticlesEffect, Hybrid3DEffect, FlashCubeEffect * Post-process effects: GaussianBlurEffect, SolarizeEffect, ChromaAberrationEffect, ThemeModulationEffect, FadeEffect, FlashEffect - Added examples section showing common usage patterns - Documented exact parameter behaviors (e.g., blur pulsates 0.5x-2.5x, flash triggers at intensity > 0.7, theme cycles every 8 seconds) ## Code Quality & Verification - Audited all hardcoded 1280x720 dimensions throughout codebase - Verified all shaders use uniforms.resolution and uniforms.aspect_ratio - Confirmed Effect::resize() properly updates width_/height_ members - No issues found - dimension handling is fully dynamic and robust ## Files Changed - tools/seq_compiler.cc: Parse [end_time], generate set_end_time() calls - src/gpu/effect.h: Added end_time_, set_end_time(), get_end_time() - src/gpu/effect.cc: Check sequence end time in update_active_list() - assets/demo.seq: Comprehensive syntax and effect documentation - Generated files updated (timeline.cc, assets_data.cc, music_data.cc) This work establishes a more flexible sequencing system and provides developers with clear documentation for authoring demo timelines. handoff(Claude): Optional sequence end times implemented, effect documentation complete, dimension handling verified. Ready for next phase of development.
Diffstat (limited to 'assets/final/shaders/solarize.wgsl')
-rw-r--r--assets/final/shaders/solarize.wgsl40
1 files changed, 31 insertions, 9 deletions
diff --git a/assets/final/shaders/solarize.wgsl b/assets/final/shaders/solarize.wgsl
index 9bd0212..fcb9d80 100644
--- a/assets/final/shaders/solarize.wgsl
+++ b/assets/final/shaders/solarize.wgsl
@@ -23,15 +23,37 @@ struct Uniforms {
@fragment fn fs_main(@builtin(position) p: vec4<f32>) -> @location(0) vec4<f32> {
let uv = p.xy / uniforms.resolution;
var col = textureSample(txt, smplr, uv);
- let thr = 0.5 + 0.3 * sin(uniforms.time);
- if (col.r < thr) {
- col.r = 1.0 - col.r;
- }
- if (col.g < thr) {
- col.g = 1.0 - col.g;
- }
- if (col.b < thr) {
- col.b = 1.0 - col.b;
+
+ // Patterns are 2 seconds long (120 BPM, 4 beats)
+ let pattern_num = u32(uniforms.time / 2.0);
+ let is_even_pattern = (pattern_num % 2u) == 0u;
+
+ // Reduced threshold range for subtler effect
+ let thr = 0.4 + 0.15 * sin(uniforms.time);
+ let solarize_strength = 0.4; // Reduced from 1.0 for less saturation
+
+ if (is_even_pattern) {
+ // Even patterns: Subtle red-orange tint
+ if (col.r < thr) {
+ col.r = mix(col.r, 1.0 - col.r, solarize_strength);
+ }
+ if (col.g < thr) {
+ col.g = mix(col.g, 1.0 - col.g * 0.7, solarize_strength * 0.7);
+ }
+ if (col.b < thr) {
+ col.b = mix(col.b, col.b * 0.5, solarize_strength);
+ }
+ } else {
+ // Odd patterns: Subtle blue-cyan tint
+ if (col.r < thr) {
+ col.r = mix(col.r, col.r * 0.6, solarize_strength);
+ }
+ if (col.g < thr) {
+ col.g = mix(col.g, 1.0 - col.g * 0.8, solarize_strength * 0.8);
+ }
+ if (col.b < thr) {
+ col.b = mix(col.b, 1.0 - col.b, solarize_strength);
+ }
}
return col;
}