From c8a23e2e2c6fa2af5d971e785f74c5889bbb46dd Mon Sep 17 00:00:00 2001 From: Roz K Date: Sun, 15 Jun 2025 16:49:25 +0200 Subject: [PATCH] shader cleanup --- unfish_gopro_8-7_wide_hypersmooth-off.glsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/unfish_gopro_8-7_wide_hypersmooth-off.glsl b/unfish_gopro_8-7_wide_hypersmooth-off.glsl index 66fcf61..cfe28a6 100644 --- a/unfish_gopro_8-7_wide_hypersmooth-off.glsl +++ b/unfish_gopro_8-7_wide_hypersmooth-off.glsl @@ -1,5 +1,6 @@ // RozK -// Adapted from https://github.com/duducosmos/defisheye, +// Fisheye removal for GoPro 11+, 8:7 ratio, without hypersmooth +// Adapted from https://github.com/duducosmos/defisheye // itself based on http://www.fmwconcepts.com/imagemagick/defisheye/index.php #extension GL_ARB_texture_rectangle: enable @@ -11,18 +12,17 @@ uniform vec2 myResolution; uniform float pts; const vec2 half_pixel = vec2(0.5, 0.5); -const float pi = 3.1415927; const float input_fov = 156.0; -const float output_fov = 120.0; +const float output_fov = 119.789529; vec2 unfish(vec2 coord) { float diameter = sqrt(dot(myResolution, myResolution)); vec2 center = myResolution * 0.5; vec2 position = coord - center; float input_distance = length(position); - float input_foc = diameter * 180.0 / (input_fov * pi); - float output_foc = diameter / (2.0 * tan(output_fov * pi / 360.0)); + float input_foc = diameter / radians(input_fov); + float output_foc = diameter / (2.0 * tan(radians(output_fov) * 0.5)); return center + position * (input_foc * atan(input_distance / output_foc) / input_distance); }