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

SSAO and SSIL Break with Odd Resolutions #73697

Open
mrjustaguy opened this issue Feb 21, 2023 · 7 comments · Fixed by #73698
Open

SSAO and SSIL Break with Odd Resolutions #73697

mrjustaguy opened this issue Feb 21, 2023 · 7 comments · Fixed by #73698

Comments

@mrjustaguy
Copy link
Contributor

Godot version

4.0 rc 3

System information

Windows 11, Vulkan, GTX 1050 Ti 528.24

Issue description

SSAO/SSIL at full Res breaks when using Non-Even Resolutions (Half res works just fine)

image

Steps to reproduce

Set Viewport to Non-Even Resolution and Disable Half Size, and look at a Plane from a distance

Minimal reproduction project

N/A

@ghost
Copy link

ghost commented Feb 21, 2023

I also get these beautiful ones. They disappear when SSIL is off. Is this the same issue, a known one, or should I report it?
2023-02-21

@Calinou
Copy link
Member

Calinou commented Feb 21, 2023

I also get these beautiful ones. They disappear when SSIL is off. Is this the same issue, a known one, or should I report it? 2023-02-21

This appears to be the same as #56724.

@mrjustaguy
Copy link
Contributor Author

This issue has not been solved in RC6, just heavily mitigated, odd resolutions still cause SSAO/SSIL at full res to produce streaking artifacts similar to OP, just much weaker and more centered around the middle of the screen.

image

@Calinou Calinou reopened this Feb 27, 2023
@Calinou Calinou modified the milestones: 4.0, 4.x Feb 27, 2023
@BastiaanOlij
Copy link
Contributor

This one is really starting to do our heads in :) Talking to clay about how we could finally put this to bed but we really need some solid MRP for this as we fix one thing and another problem returns that doesn't show up in the tests we're using.

Talking with @clayjohn about this but the zest of my theory is as follows:

The root problem here is that we're slicing the screen into 4 for each effects buffer for performance reasons.
So say as a worst case example a screen resolution of 999x599 becomes 4 times 250x150 (of 125x75 at half resolution).

The original problem causing the weird artifacts in the border were caused because the way the sizes are calculated resulted that we were only populating at a resolution of 249x149 ending up with only calculating data for 996x596 of the image, leaving a border of 4 pixels at the bottom and right side of the image with whatever data was there before. You start to notice issues especially when resizing as the data there will be left overs from other textures freed up and totally not suitable for what we're doing.

So that was fixed ensuring that we render to the full 250x150 resolution of each slice, the problem now is that our effects buffers have a total screen size of 1000x600, one pixel to many, I suspect that the streaking is caused because some of the processes will stretch the source image by 1 extra pixel, while others just see the extra pixel as outside of the source image.

The effect is worsened if you run SSAO at half size and SSIL at full size, or vise versa, because of the way we calculate size that way where I think we do a rounding that no longer matches the buffer size which is now the first mip of the full size.

Still trying to figure out how best to fix this.

@mrjustaguy
Copy link
Contributor Author

mrjustaguy commented Feb 28, 2023

Problem here is that it's not something that one can make a good MRP for, as camera positions, and viewport resolutions matter, and fixing one part likely breaks some other scenario.

Weird part is Half size is perfectly fine right now consistently.

@MineBill
Copy link
Contributor

I've encountered this problem with SSAO and SSR (and SSIL i think). However, in my case, it only happens when MSAA 3D 2x is enabled (4x and 8x work ok). Since no one else has mentioned MSAA in any of the linked issues, i'm wondering if it's something different and i should open a new issue with a MRP and more info.

@mrjustaguy
Copy link
Contributor Author

It is a different issue, there have been reports with corruption with MSAA and some screen space effects, on AMD Polaris for example.

I haven't encountered any issues like this with SSR, only SSAO and SSIL (which are using the same underlying logic more or less)

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.

4 participants