Skip to content

Commit

Permalink
add motion-extraction-mask
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Apr 6, 2024
1 parent 31844a6 commit d14b29e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions resources/public/shaders/video-delay-shader.frag.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ void main() {
vec4(0.0,inv10.g,0.0,0.3)+
vec4(0.0,0.0,inv25.b,0.6);
color = color0+motion;
} else if (u_mode == 9) { // motion-extraction-mask
// https://www.youtube.com/watch?v=NSS6yAMZF78
vec4 inv0 = vec4(1.0-color0.r,1.0-color0.g,1.0-color0.b,0.5);
vec4 inv10 = vec4(1.0-color10.r,1.0-color10.g,1.0-color10.b,0.5);
vec4 inv25 = vec4(1.0-color25.r,1.0-color25.g,1.0-color25.b,0.5);
vec4 motion =
vec4(inv0.r,0.0,0.0,0.33)+
vec4(0.0,inv10.g,0.0,0.33)+
vec4(0.0,0.0,inv25.b,0.33);
color = vec4(color0.rgb*(color0.rgb+motion.rgb),1.0);
}

gl_FragColor = color;
Expand Down
3 changes: 2 additions & 1 deletion src/shimmers/sketches/video_delay_shader.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
:edge-detection-length
:edge-detection-length-div
:edge-detection-length-mix
:motion-extraction])
:motion-extraction
:motion-extractino-mask])

(defonce ui-state (ctrl/state {:mode :color-delay}))

Expand Down

0 comments on commit d14b29e

Please sign in to comment.