Improved my motion blur quite a bit. It turned out that a fast blur path of the shader sometimes kicked in at unexpected times due to the threshold for it being too low, so now it only kicks in if the fast path would yield very close to the same result. That made it a bit slower in some cases, but in most cases it has no significant impact on performance
In addition, I found a way of renormalizing the weights based on the maximum motion vector spread of the pixels processed. This helped in cases where a single fast moving pixel could cause an entire 3x3 area of tiles to get a very high dominant motion vector, effectively corrupting the motion blur of slow-moving objects around it and showing an ugly reduction in blurriness for nearby pixels. This was most visible when the camera was moving and a foreground object was moving fast on the screen, causing the slower moving background around it to get a reduced amount of motion blur. Although my fix isnât perfect, itâs a LOT better than nothing, and together with the fast path fixes it really improved the quality, stability and continuity of the motion blur. I really like the result.
In the following picture, the old and new technique is compared. The problem here is that the foreground objects are moving much faster than the distant tall wall, and the tiles around the foreground object donât compute the motion blur for the background walls correctly. The left side is the how the blur looks with my renormalization. The green circles highlight areas that it improved. The right side uses the old version and the red circles show the artifacts that are fixed by the renormalization.
Tomorrow I will look into just one more thing. Since my anti-aliasing is applied before the motion blur (the guy in the middle that isnât moving looks great), the motion blur doesnât get anti-aliased. If you look closely at the motion blur at the top of the big white thing to the left, the top edge looks quite aliased. I think I can with a clever AA-system offset the blur a tiny bit to get some anti-aliasing on the motion blur edges as well.