Hello Community,

I am going to extend my 3D-Engine with a Motion Blur effect. Therefore i want to compute the pixel screen-velocity in a compute shader. Current scene frame and depthbuffer is rendered into two texture samplers.

I did a lot research about that topic and changed my code many times but finally the Motion Blur effect does not work as intended. Pixel velocity only considers camera moving but not camera rotating. I detected that my transformation from ndc to eye-space is not correct but i don't know how to fix it.

I linearzie the the depth value from depthbuffer as follows:

I tested that linearization in my application and it seems to be correct.Code :lin_depth = 2 * near / (far + near - depth * (far - near))

Now i define the NDC as usual:

I compute the clip-Position w as i found here https://www.opengl.org/wiki/Compute_...m_NDC_to_clip:Code :vec3 NDC = vec3(window.x * 2 - 1, window.y * 2 - 1, lin_depth);

Now i should be able to get the eye-Position with the inverse ProjectionCode :float Cw = projectionMatrix[2][3] / (NDC.z - projectionMatrix[2][2]);

but as i tested these computations in my application, the eye space position i get is wrong.Code :vec4 eyePos = (inverseProjectionMatrix) * vec4(NDC * Cw, Cw);

My projection Matrix is defined as follows:

Remember at my Cw-calculation i send the matrix transposed to the glsl-shader.Code :1/(tanFOV*aspect) 0 0 0 0 1/tanFOV 0 0 0 0 (-zNear-zFar)/(zNear-zFar) 2*zFar*zNear/(zNear-zFar); 0 0 1 0

Tanks in advance if somebody can help me!

greetings, Fynn Fluegge