Add Temporal Anti-Aliasing
Is your feature request related to a problem? Please describe. F3D supports two anti-aliasing method: FXAA and SSAA Both are quite useful for performance and quality, repectively. Supporting Temporal Anti-Aliasing would be great to combine performance and quality, at the cost of accumulating several frames over time to get the final image.
Describe the solution you'd like
- Add a new
render.effect.antialiasing.modevaluetaa - Add a new CLI value for
--anti-aliasing-mode - Add testing and doc
Technical insights
From reading on it, jittering would be added to the vertex shader and the jitter would be resolved in the fragment shader.
Jittering would be added to vtkF3DPolyDataMapper, resolving to a class with an interface similar to vtkSSAAPass, called vtkF3DTAAResolvePass.
The implementation will be done in two phases:
- [x] Implementation for static scenes only, the history buffer is cleared when camera moves
- [ ] Implementation of a valocity buffer in order to reproject the history and get TAA for animated scenes
Good article: https://sugulee.wordpress.com/2021/06/21/temporal-anti-aliasingtaa-tutorial/
I think we can focus on static scenes at the moment and clear the history buffer if the camera moves.
It will produce ghosting for animated scenes but it's ok for a first version, we'll introduce a velocity buffer later.
So, the jitter values can be hardcoded and sent to the GPU through a uniform vec2 value. You're right, I think we need a vtkF3DTAAResolvePass which will render the scene with its delegate, and use a full screen quad shader to resolve it into the final frame.
Note that you will need to set the uiOnly boolean in vtkF3DRenderPass::Render to false when TAA is enabled.
https://github.com/f3d-app/f3d/issues/2237 looks like a duplicate?
Good point. @Meakk wanna merge them ?
Closing the previous one as this one has more info
I would like to look into this.
I would like to look into this.
Commonly TAA jitters the clip space by modifying camera projection matrices, which is the same compared to jitter the vertex, but in most case easier to implement (especially screen-space UIs are not effected). Please let me know which approach is easier to implement for existing codebase.
Of course!
@AoGao-Kedoka any progress so far?
@Meakk Hi, just started. Had https://github.com/f3d-app/f3d/pull/2352 previously and didn't managed to work on it parallel.
Need help moving forward @AoGao-Kedoka ?
Hi @mwestphal , I made some progress last time, but I’ve been really busy with other things recently. I’ve already planned to pick it up again next week.
I think this issue can either be closed or be updated for velocity buffer? @Meakk
I will update the issue to mention a velocity buffer must be implemented for animations.
TAA implemented by @AoGao-Kedoka for static meshes here: https://github.com/f3d-app/f3d/pull/2501
@AoGao-Kedoka Unassigning for now, do not hesitate to comment here if you start working on the velocity buffer :)
@mwestphal I currently have quite limited availability, but I've slowly started looking into it. I guess you can assign me for now and if someone is interested and have more time, feel free to unassign me.
Ok!