Reflection/refraction with chromatic aberration - eye correction
I am writing a GLSL shader that simulates chromatic aberration for simple objects. I am staying OpenGL 2.0 compatible, so I use the built-in OpenGL matrix stack. This is the simple vertex shader: uniform vec3 cameraPos; varying vec3 incident; varying vec3 normal; void main(void) { vec4 position = gl_ModelViewMatrix * gl_Vertex; incident = position.xyz / position.w - cameraPos; normal = gl_NormalMatrix * gl_Normal; gl_Position = ftransform(); } The cameraPos uniform is the position of the camera in model space, as one might imagine. Here is the fragment shader: const float etaR = 1.14; const