-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
skybox.wgsl: Fix precision issues #9909
Conversation
1.0, | ||
1.0 | ||
); | ||
let view_position = view_position_homogeneous.xyz / view_position_homogeneous.w; |
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.
view_position_homogeneous.w
is constant 1.0 from above
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.
Right, copy pasta.
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.
Actually no. This was wrong. The vec4 position is multiplied by the inverse projection matrix, so the resulting w is not guaranteed to be 1.0.
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.
oops right
# Objective - Fixes bevyengine#9707 ## Solution - At large translations (a few thousand units), the precision of calculating the ray direction from the fragment world position and camera world position seems to break down. Sampling the cubemap only needs the ray direction. As such we can use the view space fragment position, normalise it, rotate it to world space, and use that. --- ## Changelog - Fixed: Jittery skybox at large translations.
Objective
Solution
Changelog