godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.15k stars 97 forks source link

Implement temporal antialiasing (TAA) in the Vulkan renderer #3401

Closed Calinou closed 2 years ago

Calinou commented 3 years ago

Related to https://github.com/godotengine/godot-proposals/issues/2779, https://github.com/godotengine/godot-proposals/issues/3855 and https://github.com/godotengine/godot-proposals/issues/4280.

Describe the project you are working on

The Godot editor :slightly_smiling_face:

Describe the problem or limitation you are having in your project

Right now, we have MSAA and FXAA available in both 3.x and master. These algorithms serve their intended purposes, but each of them has their own limitations:

It's possible to use both MSAA and FXAA at the same time, but this has a significant cost and it won't improve the image's sharpness after it has been reduced by FXAA.

It's great that MSAA is still supported in master (thanks to the clustered forward renderer), but we have to admit that it's difficult to use in production with today's shader complexity. Therefore, this makes MSAA mostly suited to games that use few visual effects, which generally implies a stylized art direction.

TAA is also the antialiasing algorithm that usually works the best with FSR.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Temporal antialiasing uses information from previously rendered frames to reduce aliasing on the current frame.

Unlike MSAA, TAA works on aliasing generated by shaders such as specular aliasing. With the current screen-space roughness limiter not being very effective, this will provide a good alternative when specular aliasing is an issue. This is the main draw for using TAA, but TAA also often performs better than MSAA.

TAA can also be used as an upscaling method when rendering 3D at a lower resolution. This is not a goal for an initial implementation, but it could be looked at later.

The downsides of TAA are:

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

In any case, TAA isn't quite a "plug and play" solution. There's a lot of work involved in making it work well enough for production use, which is why this proposal is targeting 4.1 or later.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, as TAA needs to integrate with low-level rendering functionality.

Is there a reason why this should be core and not an add-on in the asset library?

See above.

Zireael07 commented 3 years ago

Motion vectors please please <3 IIRC there's an open request for motion blur?

jcostello commented 2 years ago

@Calinou Is this in the scope of 4.0?

Calinou commented 2 years ago

@Calinou Is this in the scope of 4.0?

reduz said he'd like to work on implementing TAA for 4.0, but he is currently dealing with moving to Spain. Therefore, I can't guarantee he'll be able to implement this by the time 4.0 is released.

clayjohn commented 2 years ago

Is this in the scope of 4.0?

It is if someone has the time to implement it! But as Calinou points out above, if we are relying on reduz doing it then it will likely be after 4.0.

LaserYGD commented 2 years ago

This would be great, nowadays TAA is a must for games using PBR. Specular aliasing is just too much.

Calinou commented 2 years ago

@LaserYGD Please don't bump issues without contributing significant new information. Use the :+1: reaction button on the first post instead.

For reference, TAA is currently being worked on as we speak, but it's not ready to be open as a pull request yet. A complete TAA implementation is a lot of work – you need to account for MultiMeshes, skinned meshes, shaders that move vertices around, soft bodies, …

TAA is aimed at being finished for 4.0, but I can't give any guarantees on whether TAA will actually be available in 4.0.