festl shader progress

This commit is contained in:
Jakob 2023-06-23 11:09:51 +02:00
parent 4d64d911fb
commit 0803782ce1
6 changed files with 62 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "lib/lygia"]
path = lib/lygia
url = https://github.com/patriciogonzalezvivo/lygia.git

1
lib/lygia Submodule

@ -0,0 +1 @@
Subproject commit 72e57240f5abde099fb451d156087c812a181e1f

1
src/2023-06-21.festl_is/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
video.mp4

View File

@ -0,0 +1,3 @@
test:
glslViewer main.frag video.mp4 -w 960 -h 540 --nocursor --fps30

View File

@ -0,0 +1,43 @@
#ifdef GL_ES
precision mediump float;
#endif
// always available
uniform vec2 u_mouse; // mouse pixel coordinates
uniform vec2 u_resolution; // viewport resolution in pixels
uniform float u_time; // in seconds
uniform float u_delta; // delta time between frames (in seconds)
varying vec2 v_texcoord;
// video in
uniform sampler2D u_tex0;
uniform vec2 u_tex0Resolution;
// lygia effects
#define CHROMAAB_TYPE vec4
#include "../../lib/lygia/distort/chromaAB.glsl"
//#include "sample/nearest.glsl"
void main() {
// common setup
vec4 color = vec4(vec3(0.0), 1.0);
vec2 pixel = 1.0/u_resolution.xy;
vec2 st = gl_FragCoord.xy * pixel; // 0-1
vec2 uv = v_texcoord;
// set video
color = texture2D(u_tex0, st, 1.0);
// chromatic aberration
color = chromaAB(u_tex0, uv);
//color.rgb = mix(texture2D(u_tex0, uv).rgb,
// sampleNearest(u_tex0, uv, u_tex0Resolution).rgb,
// step(0.5, st.x));
// actually set color
gl_FragColor = color;
}

View File

@ -0,0 +1,11 @@
* preparation
* [ ] make sure videos are in right format
* Makefile
* [ ] add command to extract ratio from mp4
* code
* [ ] barebones shader