Hello.
I'm having problems with my motion vector calculations.
The camera is only very barely moving, but as you can see the motion vectors of the bottom left tile are calculated incorrectly when the camera gets too close. I believe the problem happens due to the projection ending up behind the camera (at least one vertex is behind the camera).
I calculate my motion vectors for each vertex like this:
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);
vec4 previousPosition = previousViewProjectionMatrix * previousModelMatrix * vec4(position, 1.0);
motionVector = gl_Position.xy / gl_Position.w - previousPosition.xy / previousPosition.w;
I am unsure how to fix this. The problem seems to come from the motion vectors becoming extremely large, large enough to cause the whole triangle to receive motion blur after interpolation. Any help would be appreciated!