Do I have to take aspect ratio into account, when computing a direction in View Space?
After thinking about it, I have a question, which concerns the provided GLSL code snippet of the Fragment Shader.
To calculate the ray direction, the author uses the FocalLength (distance of the projection plane from view point) as Z-component, and the fragment coordinates in NDC-space as xy component. This gives a vector pointing from the view point to the pixel on the projection plane which is computed. Obviously this direction is supposed to be in View Space, because it assumes 0,0,0 as view point and the ModelView Matrix is used to convert the direction to object-local space. But I am not sure if that is correct, because isn't it that in view space the projection window isn't necessarily normalized, but has a width of twice the aspect ratio? It gets normalized by applying the projection matrix (at least in Direct3D as far as i know). So if this is true, why does this work? Why he maps the x component of gl_FragCoord to [-1;1], when the leftmost pixel would have an x-coordinate of -aspectRatio in view space?