After re-finding this article (http://john-chapman-graphics.blogspot.com/2013/01/what-is-motion-blur-motion-pictures-are.html) I decided I would try and tackle motion blur. It’s really not that complicated of an effect, and I thought I could implement it rather easily. Of course, I was wrong.
I’m sending in the inverse of the model view matrix as well as the previous model view projection matrix correctly. I’m multiplying the view matrix of the camera (rotation matrix * translation vector) by the transformation matrix (world/model matrix).
I’m inverting it using this code, taken from the jMonkeyEngine but converted to work with my matrices:
http://pastebin.java-gaming.org/6f68e1a7f90
I believe this works just fine. If you have a better/simpler way to invert a matrix, do tell.
I also have a linearized depth texture.
After that, I get the position of the current pixel in view space and then do all the other fancy stuff that gets me my blur vector. Then I blur… along that vector. Surprising, right?
GLSL Code:
http://pastebin.java-gaming.org/f68ea2f7099
Well, everything runs fine however when I move, nothing happens. Nada.
But check this out; if I multiple blurVec by 100, I get a constant blur at a vector that seems to be about 1, 1. It looks like this:
I am not moving in this at all, just standing still. Therefore, when I’m not even moving, the blur vector is a very small value around 0.001 on the x and y. It stays this way when I am moving too though.
Is there anything you can think of off the top of your head why this may be happening?
Thanks
P.S. This is what the position looks like, used as color: