-
-
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
Fix incorrect distance given by ViewRangefinder3d #11993
Conversation
This PR is a major improvement and almost fixes #11608 issue. Under normal circumstances, the bug is gone, but I noticed the same behavior happens under extreme angles. But if the camera's direction vector is pointing in the direction of the plane's normal vector while the plane is still visible, the order issue is still there. (note that the middle plane is at 0,0,0, so if we see it's back that means we are looking in the direction of the plane's normal) |
Sorry I don't really get what you mean. How the plane can be visible if its front face points outward from the camera? |
@IDEDARY Okay I get it. |
@IDEDARY Why the plane positions along X and Y are different? For the two planes having order issue, their positions are as follows.
From the render result, I suppose the two planes should have different Z coordinate only. |
@IDEDARY Considering the |
I don't believe so, but I will carry out further investigation and try to create a minimal recreation project without my layouting. It should give us some insight into the origin of the problem. Im unsure about the different cords, but I use parenting. Quads are defined through center point and they aren't perfectly centered either so it might come from that. But I will also look into it. |
@floppyhammer I have created bare-bones reproducible (roughly 100 lines of code) without any of my layouting code present. It's the same thing, but the abstraction is removed. The issue is unfortunately still present :/ |
@IDEDARY I'll look into it. |
I'm closing this as this solution is not good enough. We might need a more sophisticated solution (e.g. BSP trees) to handle the order issue. |
Objective
Fixes #11608.
Solution
This PR makes ViewRangefinder3d calculate object-to-camera distance correctly in order to sort them properly.
Migration Guide
In sturct
ViewRangefinder3d
,from_view_matrix
has been renamed tofrom_view_proj_matrix
.