-
-
Notifications
You must be signed in to change notification settings - Fork 19.7k
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
[3.x] Fix SSAO stairstepping artifacts when using a high Camera Far property #53784
base: 3.x
Are you sure you want to change the base?
Conversation
This matches `master` behavior where high Camera Far properties can be used just fine with SSAO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right approach. What will happen with this change is that the depth buffer will be treated as if it is only 200 units deep (even if it is representing a scene that is 4000 units deep) so to the SSAO objects that are 1000 units apart will look like they are only 50 units apart. More concerningly, objects that are 20 units apart will cast SSAO as if they are one unit apart.
If you want to clamp distant SSAO, you should copy the approach used in ASSAO which is to fade the SSAO out as it approaches the maximum distance (which is configurable with a project setting)
float fade_out = clamp(pix_center_pos.z * params.fade_out_mul + params.fade_out_add, 0.0, 1.0); |
I don't think this will resolve the stairstepping artifacts that appear close to the camera though (especially when approaching a surface that's parallel to the camera). It's likely caused by a lack of depth buffer precision. Can we do both approaches here (fade distant SSAO and limit camera Z far)? |
Perhaps. We can't control the depth buffer precision, because that is set elsewhere. But maybe doing a combined approach can work to reduce the depth precision artifacts while also reducing the artifacts that come from arbitrarily scaling the depth values. What is the highest Z-far we can use without introducing the stair stepping artifacts? I am thinking it you set the max Z-far to something like 2000 then the scaling artifacts should be minimal. |
I already get significant artifacts when up close at Z-far = 1000. I'd say 500 is the maximum value where it's acceptable, but you can still notice artifacts if you look for them (compared to 200). |
71cb8d3
to
c58391c
Compare
This matches
master
behavior where high Camera Far property values can be used just fine with SSAO.This closes #42390.
Testing project: test_ssao_2_3.x.zip
Preview
Camera Far 100 (project default in
3.x
)Camera Far 500 (editor default in
3.x
)Camera Far 4,000 (default for both project and editor in
master
)