godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.57k stars 20.31k forks source link

Vulkan: TAA smears Skyboxes #67332

Open unfa opened 1 year ago

unfa commented 1 year ago

Godot version

v4.0.beta.custom_build [ca25c6e0a]

System information

Arch Linux, KDE, AMD RX6800XT, Mesa, Vulkan, Clustered+

Issue description

Temporal Anti-Aliasing seems to recieve no motion vectors for skybox textures, resulting in motion smearing when rotating the camera.

This is especially aparrent with textures detailed enough so that TAA's blending threshold doesn't kick in:

Here's an example with PhysicalSky using a spreckly FastNoiseLite texture in the "Night Sky" slot to imitate stars. ooking around causes massive smearing. Note the difference between the textured ground and the sky - both were moving the same way on-screen.

Screenshot_20221013_014914

Steps to reproduce

Use a very grainy, 4x2K resolution texture and put it either into PhysicalSky's Night Sky rtexture slot or into PanoramicSky.

Minimal reproduction project

Here's a simple project that demonstrates this with a rotating camera:

TAA vs Skybox.zip

I've also added an alpha-blended sprite to demonstrate how transparency overwrites motion vectors for anything that's behind it regardless of alpha value.

clayjohn commented 1 year ago

You mention motion vectors a few times in this Issue, are you seeing motion vectors when you turn the motion vector debug mode on? The skybox should not generate any motion vectors at all, so if it is, that could point us in the direction of the bug.

unfa commented 1 year ago

@clayjohn I tried that but I saw only pure blackness.

EMBYRDEV commented 1 year ago

You mention motion vectors a few times in this Issue, are you seeing motion vectors when you turn the motion vector debug mode on? The skybox should not generate any motion vectors at all, so if it is, that could point us in the direction of the bug.

The sky shader doesn't appear to do any sort of TAA handling and isn't even being fed the previous frame's data yet.

ValeronSA commented 8 months ago

Motion vectors are not calculated when the camera is rotated, which is why the sky is blurred when rotated. At the same time, for FSR2 the sky is calculated correctly. image