summaryrefslogtreecommitdiff
path: root/assets/final/shaders/solarize.wgsl
diff options
context:
space:
mode:
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;
}