Excellent job! I’m happy you have found this is useful too!
It is a very neat idea, and was among the first things i was trying to improve on the quality, but it happen to have a very grim side effect on the ghosting. Once you move your camera, the excluded luminance informations will result in a very low mask information for those areas, thus it results in a “hole cutting” effect, and the ghosts get’s reduced to some degree, but their halo will remain to be very apparent.
While i was looking for a solution to this problem i actually have found a very neat luminance extraction trick in the temporal aa’s code, which is not used by the main aa pass but some of the less interesting ones only.
min(abs(LumaMin-LumaHistory), abs(LumaMax-LumaHistory))
This will result a so very thin line around the object that it helps to preserve the antialiased edges, but once you move your camera the history information will result in high mask areas. With a little exaggeration of its effect the result look very promising.
(The applied mask can be seen on the right side of the viewport)
As usual, the video quality is terrible, but the resulting mask is quite useful to reduce the bluring AND it provides very strong shape masks for the ghost reduction, all in one equation. But it’s not good enough, and there are cases where the resulting ghost mask will actually paints a bit of a ghost on it’s own because the extracted luma information gets mixed together with the background, and it essentially results in a new ghosting artifact. I fine tuned this in the video to reduce it’s side-effects but i found this equation not good enough to all circumstances. It helps, but not enough. But still it is a very neat little trick i recommend you to look into this!
As i have mentioned this before, a more robust anti ghosting solution is on my desk currently i’m working on, which basically extract the deghost mask from the depth differences by using a custom temporal buffer to store and retrieve it. A bit complicated but the result is very effective against ghosts, but on the fine details it have medium effects only. It also does not take luma differences into the equation (since it is a depth only information) thus a combination of the both techiques is what i’m welding together, currently. The results are promising.
One thing that also bothers my mind is the specular aliasing issue which accidently can pop in on the deghosted areas. The current implementation of TAA also suffer of this error, but that does not take me away to looking for a solution to that. The idea would be a very strong negative value that is introduced to the depth difference equation, in order to reduce it’s effectiveness on the areas where the shiny things are gleaming in.