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

Fix LOD selection in compatibility backend and clean up LOD code #92287

Merged
merged 1 commit into from
May 28, 2024

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented May 23, 2024

Fixes: #67479
Fixes: #89394
Fixes: #78664
Fixes: #73472
Fixes: #78422

  1. Applies the fix from Only apply LOD when camera is outside the AABB of mesh in mobile renderer. #92232 to the Compatibility backend
  2. Removes camera_plane from the shadow_pass struct (this was unused)
  3. Uses Camera transform for shadow LOD calculations so shadows match the object. This significantly reduces shadow acne and stabilizes the shadow profile.

I have another PR coming to fix- #81995, but I separated these changes out in the meantime as these are very safe changes

CC @mrjustaguy

@clayjohn clayjohn added this to the 4.3 milestone May 23, 2024
@clayjohn clayjohn requested a review from a team as a code owner May 23, 2024 18:00
@Calinou
Copy link
Member

Calinou commented May 23, 2024

Uses Camera transform for shadow LOD calculations so shadows match the object. This significantly reduces shadow acne and stabilizes the shadow profile.

It might be worth checking if this fixes shadows in orthographic camera sometimes using very low-detail shadow LODs (despite camera Z far being low), while the mesh is being drawn with its full detail.

@clayjohn
Copy link
Member Author

Uses Camera transform for shadow LOD calculations so shadows match the object. This significantly reduces shadow acne and stabilizes the shadow profile.

It might be worth checking if this fixes shadows in orthographic camera sometimes using very low-detail shadow LODs (despite camera Z far being low), while the mesh is being drawn with its full detail.

Do you have a bug report/MRP for that? I don't think this PR will help in that situation, but I can look into it

@mrjustaguy
Copy link
Contributor

Pancake issue is gone
The Original issue is, mostly gone.
There is still occasionally weird LOD decisions happening with Shadows, but it's really not a big deal unlike the prior two issues that were each in their own ways highly problematic and very obvious even without dedicated attempts to break things like this

image

image

MRP:
Test.zip

@Calinou
Copy link
Member

Calinou commented May 24, 2024

Do you have a bug report/MRP for that? I don't think this PR will help in that situation, but I can look into it

You can see it on the last GIF in this issue: #73472

The round object has a square shadow.

@clayjohn
Copy link
Member Author

Do you have a bug report/MRP for that? I don't think this PR will help in that situation, but I can look into it

You can see it on the last GIF in this issue: #73472

The round object has a square shadow.

Thanks! Tested that MRP and I can confirm that this fixes the issue

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm no rendering expert, but the overall code change looks sensible to me, and this would be a welcome bugfix to test in beta1.

@akien-mga akien-mga merged commit 1e6b11d into godotengine:master May 28, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment