godotengine / godot

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

Screen-space effect upscaling doesn't work properly (SSAO/GI) #95865

Open Rytelier opened 3 weeks ago

Rytelier commented 3 weeks ago

Tested versions

From 4.0

System information

Godot v4.3.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 32.0.15.5599) - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 Threads)

Issue description

Some post-processing effects don't upscale properly when rendered at half resolution. For global illumination (voxel GI/SDFGI) it looks like upscaling doesn't work at all and results in low resolution looking image. image

For SSAO there are pixelated artifacts that result in weirdly doubled offset pixels. image

Steps to reproduce

Add WorldEnvironment node to the scene Enable SSAO and SDFGI

Minimal reproduction project (MRP)

screen-effect-upscale-bug.zip

Calinou commented 3 weeks ago

The artifacts on GI you're seeing aren't a bug. They're just a product of basic bilinear upscaling being performed on the GI buffer, and have been around since 4.0 had half-resolution GI implemented:

Full resolution GI

image

Half resolution GI

Screenshot_20240820_224018

Half resolution viewport, full resolution GI

image

On the second screenshot, notice how areas mostly lit by indirect light have increased stairstepping compared to the areas that receive direct light (such as the window's corner).

On the third screenshot, everything has increased stairstepping since the viewport is rendered at half resolution and upscaled with a bilinear filter (Scaling 3D > Scale project setting set to 0.5). This makes the GI buffer resolution match the one from the full-resolution viewport, but with half-resolution GI.

Regarding SSAO, I believe this is a limitation of the ASSAO technique used. If you want better quality, something like GTAO would be more suited, but it needs TAA to run fast enough. TAA makes it possible for multiple frames to have their AO samples merged together to improve quality and performance at the same time. Otherwise, the number of samples required per frame becomes prohibitive, making the effect run very slow (or look noisy).

Closing in favor of https://github.com/godotengine/godot-proposals/issues/10497, since it already tracks possible ways to improve GI buffer upscaling quality.

clayjohn commented 3 weeks ago

I recommended creating a bug report for this as the quality is far below the quality that it should be. We use an extremely basic bilinear upscale for GI and it could look much better.

The one for SSAO is more complicated, but is clearly broken in the screenshots as the quality from the official sample is much higher

IMO quality issues with built in effects are bugs. Users shouldn't have to go through the proposal process to tell us that things are not looking as good as they should.

Calinou commented 3 weeks ago

Reopening, as this is considered a bug.