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 occlusion culling for double builds by enforcing float conversion for Embree. #98770

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

Rudolph-B
Copy link
Contributor

Fixes #94638

Embree does not support double precision for its geometry buffer. I therefore created a simple float struct to force the conversion from double to float.

@Rudolph-B Rudolph-B requested a review from a team as a code owner November 2, 2024 19:39
@Calinou Calinou added bug topic:rendering topic:3d topic:core cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Nov 2, 2024
@Calinou Calinou added this to the 4.4 milestone Nov 2, 2024
@AThousandShips AThousandShips changed the title Fixed occlusion culling for double builds by enforcing float conversion for Embree. Fix occlusion culling for double builds by enforcing float conversion for Embree. Nov 3, 2024
@Rudolph-B Rudolph-B force-pushed the Issue-94638 branch 2 times, most recently from c13d712 to 1295d29 Compare November 21, 2024 03:48
@Rudolph-B Rudolph-B marked this pull request as draft November 21, 2024 07:15
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected.

However, occlusion culling is only functional when you're not too far away from the world origin. I wonder if some form of origin shifting can be used, so that occlusion culling keeps working regardless of where you are.

Single-precision builds still work as usual.

At the origin

image

Far away from the origin (10 million units)

image

This is still an improvement over what we have now, so I'd say it's good to merge.

@Rudolph-B
Copy link
Contributor Author

I removed some old code I missed when switching to the new method

@Rudolph-B
Copy link
Contributor Author

However, occlusion culling is only functional when you're not too far away from the world origin. I wonder if some form of origin shifting can be used, so that occlusion culling keeps working regardless of where you are.

I don't see any way to implement origin shifting that won't rely on runtime baking, which at least at the moment isn't feasible

@Rudolph-B Rudolph-B marked this pull request as ready for review November 23, 2024 14:25
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.

Makes sense to me.

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Great work. I like this better than using the marshall function like we discussed in the rendering meeting. It should be lower overhead for doubles builds

@akien-mga akien-mga merged commit 6edeea9 into godotengine:master Nov 29, 2024
20 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
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:core topic:rendering topic:3d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Occlusion culling will fail if REAL_T_IS_DOUBLE is defined by compiling with precision=double
4 participants