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

Vulkan: SDFGI incorrectly reads certain high-contrast textures for cascade generation #85058

Open
Tracked by #55327
fLindahl opened this issue Nov 18, 2023 · 5 comments

Comments

@fLindahl
Copy link

Godot version

v4.1.3

System information

Godot v4.1.3.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated AMD Radeon RX 6900 XT (Advanced Micro Devices, Inc.; 31.0.22023.1014) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

Issue description

Trying to use SDFGI, but I'm getting strange artefacts and incorrect bounce colors. Checked the cascades and the pictures show (I think) the problem.

godot_cascades
godot_normal

Any ideas on why this happens?

I've tried loading different scenes with different textures, and it seems to work fine with most assets, but with these specific textures (no matter if they're jpg, bmp or png), it just doesn't work as expected. The textures are quite basic and without a lot of color, and I'm thinking that it might be a compression issue specifically for SDFGI. I've attached the GLB as well, so that others can test.

Steps to reproduce

  1. Setup SDFGI in scene with directional light.
  2. Add entrance.glb into scene
  3. Enable visualization of SDFGI cascades

Minimal reproduction project

entrance.zip

@clayjohn clayjohn added this to the 4.x milestone Nov 18, 2023
@Calinou
Copy link
Member

Calinou commented Nov 20, 2023

SDFGI doesn't use VRAM compression (it's generated in real-time), so this looks like a more generic type of corruption.

@fLindahl
Copy link
Author

I did some further testing and took some more screens:

cascades
normal

Those are the same view, same material, in sdfgi cascade view and normal view.
I set the SDFGI cascades to be a single cascade and changed the cellsize to be 0.02 (very small voxels). You can make out that the "general shape" of the colors are there, but the actual colors are crunched into oblivion. Is there some bias towards more vibrant colors that goes bonkers with such low fidelity textures? I know I've seen biasing towards vibrant colors in other GI implementations to get more pronounced color bleeding effect.

@Calinou

This comment was marked as resolved.

@fLindahl
Copy link
Author

SDFGCornell.zip

Minimal repro

@Calinou
Copy link
Member

Calinou commented Nov 20, 2023

I don't see anything out of the ordinary in #85058 (comment) (4.2.beta da0b1eb, Linux, GeForce RTX 4090 with NVIDIA 535.129.03):

SDFGI disabled SDFGI enabled
Screenshot_20231120_152331 Screenshot_20231120_152324

Remember to disable VRAM compression on the textures in the Import dock by using Lossless compression instead. The textures used are low-resolution, so they don't use much VRAM. That said, this doesn't affect SDFGI appearance in any noticeable manner either way. I've done this on the above screenshots, which fixes the grid pattern appearing on the gray checkerboard texture on the floor.

The SDFGI debug view does have this "crunchy" appearance that you mention, but in this particular example, it doesn't really affect how visuals will look in practice. Also, remember that the normal view uses specular lighting, while the SDFGI debug view doesn't. If I set the specular mode to Disabled on the materials used by the brick textures, it looks closer to the SDFGI debug view as the bricks' mortar can actually become black in the normal view:

Normal view SDFGI Cascades view
image image

Either way, SDFGI is planned to get a rework in a future 4.x version, so this may be incindentally resolved.


With entrance.glb, I can reproduce the issue mentioned in OP:

image

Disabling VRAM compression on textures doesn't resolve the issue. I've also tried increasing texture resolution by 4× on each axis using parallel mogrify -resize 200% ::: *.png to no avail.

Reducing texture contrast using parallel magick {} +sigmoidal-contrast 10,50% {} ::: *.png largely alleviates the situation:

image

That said, even with this reduced contrast (and increased brightness), lighting from SDFGI has a lot of trouble bouncing (it's barely visible in most cases).

Testing project: SDFGCornell_2.zip

@Calinou Calinou changed the title SDFGI possible compression issues Vulkan: SDFGI incorrectly reads certain textures for cascade generation Nov 20, 2023
@Calinou Calinou changed the title Vulkan: SDFGI incorrectly reads certain textures for cascade generation Vulkan: SDFGI incorrectly reads certain high-contrast textures for cascade generation Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants