Skip to content

Commit

Permalink
play with motion-extraction using inversion
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Apr 4, 2024
1 parent 2495465 commit 31844a6
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 @@ -74,6 +74,16 @@ void main() {
} else {
color = mix(color0, color25, t*2.0-1.0);
}
} else if (u_mode == 8) { // motion-extraction
// 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.1)+
vec4(0.0,inv10.g,0.0,0.3)+
vec4(0.0,0.0,inv25.b,0.6);
color = color0+motion;
}

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 @@ -19,7 +19,8 @@
:color-edge-detection
:edge-detection-length
:edge-detection-length-div
:edge-detection-length-mix])
:edge-detection-length-mix
:motion-extraction])

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

Expand Down

0 comments on commit 31844a6

Please sign in to comment.