+"float kPi = 3.14159265358979;\n"
+"\n"
+"vec2 fisheye_distort(vec2 xy)\n"
+"{\n"
+" float aperture = 1350.0;\n"
+" float apertureHalf = 0.5 * aperture * (kPi / 180.0);\n"
+" float maxFactor = sin(apertureHalf);\n"
+"\n"
+" vec2 uv;\n"
+" float d = length(xy);\n"
+" if(d < (2.0-maxFactor))\n"
+" {\n"
+" d = length(xy * maxFactor);\n"
+" float z = sqrt(1.0 - d * d);\n"
+" float r = atan(d, z) / kPi;\n"
+" float phi = atan(xy.y, xy.x);\n"
+"\n"
+" uv.x = r * cos(phi) + 0.5;\n"
+" uv.y = r * sin(phi) + 0.5;\n"
+" }\n"
+" else\n"
+" {\n"
+" uv = 0.5*xy + 0.5;\n"
+" }\n"
+" \n"
+" return uv;\n"
+"}\n"
+"\n"
+"\n"