This question is not explictly JMonkey-related, but since I’m using JME3 at the moment, I hope this isn’t the wrong place to put it
I’m implementing single-pass ray-marching in object-space. I’m rendering the faces of a box to invoke the shader. I noticed strange artifacts when looking at specific, sharp angles, which I believe are caused by a wrong computation of the ray direction.
I’ve read several articles while looking for hints on how to compute the ray direction correctly. They all computed this direction in more or less similar ways, always involving the field of view or the focal length.
But what I don’t understand, i.e. my actual question: Why can’t I just pick the object-space eye-to-vertex vector within the vertex shader, denoted as dotted lines on the picture below, pass these vectors to the fragment shader and normalize it there? Wouldn’t this give me the fragment-dependent directional vectors that are denoted as arrows on the picture below? If yes, than aren’t these the also the correct ray directions?