Archive for the ‘ OpenGL ’ Category

Fisheye Lens (Hyperbolic Lens) Vertex Shader in GLSL

Today I will write about my fisheye (hyperbolic) lens shader. It was part of a larger project to simulate a wide depth of field and imperfections in human eyesight. Anyway, I like the way it came out, so I will describe how I went about the process in GLSL. A fisheye lens allows an extremely wide field of view, nearly 180 degrees, but it also bends the light in order to fit it all on a square so you get an interesting effect where the edges become distorted and straight lines become curved. Since it’s just an approximation, and it works on vertices, the quality is limited to the amount of vertices on screen. Here are some pictures which describe how it works. (10,000 hours in ms paint)
Continue reading