So I have implemented motion blur via depth re-construction using the depth texture and a previous view projection matrix. The shader basically finds the texel coordinate in by using the previous (frame) view projection matrix and subtract the current UV (what's given to fragment) to find a blurring vector. Then I simply blur along this vector by sampling along it and then normalize it with the number of samples, a constant I set at the beginning.

The problem I'm having is that even a tiny movement will cause the motion blur to ... well blur the scene. I find this too invasive and would like to ... "soften" this effect. I have tried to cap it by saying if the dot product of this blur vector is greater than 0.01, then blur. This sadly creates an oval like artifact in the middle the screen ...

Anyone have good suggestions on how to handle this?

  • $\begingroup$ "the dot product of this blur vector" with what? dot product has two operands. For your question, don't forget the possibility that an error in the code itself is what's making the effect too strong. $\endgroup$ – Dan Hulme Jul 5 '17 at 7:54
  • $\begingroup$ Are you happy to show your code? $\endgroup$ – trichoplax Jul 5 '17 at 11:38
  • $\begingroup$ @DanHulme, I'm using the dot product of the blur vector, so basically dot(blurVector, blurVector). This is basically the length squared to see if the blur vector is large enough. $\endgroup$ – ChaoSXDemon Jul 5 '17 at 17:09
  • $\begingroup$ Is the 'oval like artefact' because the blur is sampled in device coordinate space? $\endgroup$ – PaulHK Jul 7 '17 at 6:01
  • $\begingroup$ @PaulHK, what do you mean? NDC? I'm drawing the screen as a post-processing effect, meaning I'm drawing a square that's the size of the screen and with texture coordinate (0,0) being top left and (1, 1) being bottom right. Therefore the UV will be interpolated from top left to bottom right. $\endgroup$ – ChaoSXDemon Jul 7 '17 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.