How to retrieve eye rays for fragment shader?
I feel that I bother this part of forum for way too often. This is already something I feel like I would figure out soon on myself.
On fragment shaders, some nice effects require that you can cast a ray from the view space. I tried to do it myself like this in GLSL:
I let that interpolate through vertex shader and normalize it in the fragment shader. The problem is the left and right eye doesn't converge when I do it like this, also the eyes on the view turn as if they were inverted. I double checked that I passed the right matrices for each eye. Am I doing some misconception here?
On fragment shaders, some nice effects require that you can cast a ray from the view space. I tried to do it myself like this in GLSL:
x = mix(leftTan, rightTan, step(ndc.x, 0.0)) * ndc.x;
y = mix(downTan, upTan, step(ndc.y, 0.0)) * ndc.y;
eyeOri = eye_matrix * vec3(0.0, 0.0, 0.0, 1.0);
eyeDir = mat3(eye_matrix) * vec3(x, y, -1.0);
I let that interpolate through vertex shader and normalize it in the fragment shader. The problem is the left and right eye doesn't converge when I do it like this, also the eyes on the view turn as if they were inverted. I double checked that I passed the right matrices for each eye. Am I doing some misconception here?
