Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Calinou opened this issue Oct 7, 2021 · 6 comments · Fixed by godotengine/godot#61319
Closed

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

Calinou opened this issue Oct 7, 2021 · 6 comments · Fixed by godotengine/godot#61319

Comments

@Calinou
Copy link
Member

Calinou commented Oct 7, 2021

Related to #2779, #3855 and #4280.

Describe the project you are working on

The Godot editor 🙂

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:

  • MSAA looks good, but it is very expensive on master due to the added complexity of shaders. This is especially noticeable when using VoxelGI or SDFGI. It also doesn't smooth out aliasing that originates from fragment shaders such as specular aliasing. (Alpha-tested surfaces are now well-handled thanks to alpha antialiasing and alpha-to-coverage support.)
  • FXAA is cheap and looks decent on 1440p and higher. Unfortunately, the added blurriness makes it hard to use on 1080p and below. Post-processing sharpening algorithms make it possible to recover some of that lost sharpness, but they also add more aliasing on their own, so it's a tradeoff.

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:

  • Ghosting artifacts may be visible in fast-moving scenes. This is less noticeable at higher target framerates, but it can be an issue for competitive games. This is why having MSAA as an alternative is a good thing 🙂
  • Shaders are more complex since they need to emit motion shaders. In general, the rendering code will require a lot of changes to support TAA.

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
Copy link

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

@jcostello
Copy link

@Calinou Is this in the scope of 4.0?

@Calinou
Copy link
Member Author

Calinou commented Jan 13, 2022

@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
Copy link
Member

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

This comment was marked as off-topic.

@Calinou
Copy link
Member Author

Calinou commented Apr 28, 2022

@LaserYGD Please don't bump issues without contributing significant new information. Use the 👍 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants