-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
hello, thanks for posting your work on this. i'm curious how one might go about modifying the quiltshader for a looking glass portrait?
here's what i've tried and it doesn't quite work
// mpv glsl shader hook for looking glass PORTRAIT
// Usage sample:
// mpv --screen=1 --fs-screen=1 --fs --glsl-shader=quiltshader.glsl --no-keepaspect *.mp4
// or via input.conf:
// CTRL+1 no-osd change-list glsl-shaders set "~~/shaders/lookingglass.glsl"; set dither no; set scale nearest; set deband false; show-text "LookingGlass: enabled"
//!HOOK OUTPUT
//!DESC Looking Glass Quilt renderer
//!BIND HOOKED
float width = 1536.0f;
float height = 2048.0f;
float dpi = 324.0f;
// Calibration values
// via: https://jakedowns.github.io/looking-glass-calibration.html
float slope = -7.083540916442871;
float pitch = 52.59267044067383; //{pitch};
float center = 0.8167931437492371;
// const float tilt = -0.12039111681976107; //{tilt};
float tilt = height / (width * slope);
float pitch_adjusted = pitch * width / dpi * cos(atan(1.0f, slope));
float subp = 1.0 / (3*width) * pitch_adjusted; //{subp};
// testing interlacing SBS video
const vec2 tiles = vec2(2,1);
vec2 quilt_map(vec2 pos, float a) {
// Y major positive direction, X minor negative direction
vec2 tile = vec2(tiles.x-1,0), dir=vec2(-1,1);
a = fract(a)*tiles.y;
tile.y += dir.y*floor(a);
a = fract(a)*tiles.x;
tile.x += dir.x*floor(a);
return (tile+pos)/tiles;
}
vec4 hook() {
vec4 res;
float a;
a = (HOOKED_pos.x + HOOKED_pos.y*tilt)*pitch_adjusted - center;
res.x = HOOKED_tex(quilt_map(HOOKED_pos, a)).x;
res.y = HOOKED_tex(quilt_map(HOOKED_pos, a+subp)).y;
res.z = HOOKED_tex(quilt_map(HOOKED_pos, a+2*subp)).z;
res.w = 1.0;
return res;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels