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

Vulkan: LOD seems to be flawed, distance seems based on forward basis distance #54885

Closed
Tracked by #57416
chrisb123 opened this issue Nov 11, 2021 · 9 comments · Fixed by #67307
Closed
Tracked by #57416

Vulkan: LOD seems to be flawed, distance seems based on forward basis distance #54885

chrisb123 opened this issue Nov 11, 2021 · 9 comments · Fixed by #67307

Comments

@chrisb123
Copy link

chrisb123 commented Nov 11, 2021

Godot version

4.0dev

System information

Win10

Issue description

The LOD system seems to be flawed, it increase LOD for objects perpendicular to the camera.
If an object is way ahead and way off to a side it uses a low LOD. As you get closer, its LOD increases to maximum even when it is still way of the a side. If you look directly at the same object its LOD goes to a low level

Steps to reproduce

  1. Create a lot of high poly objects all in the same location. Enough to slow the system down when the LOD is high
  2. Move away so the LOD is low and performance is good again. I put the bias down low to exaggerate the situation
  3. Turn so the objects are to the side and still the same distance away
  4. Primitive count increases

Minimal reproduction project

LOD test2.zip

Bugsquad edit: moved MRP to the correct section

@Calinou Calinou added this to the 4.0 milestone Nov 11, 2021
@Calinou Calinou changed the title LOD seems to be flawed, distance seems based on forward basis distance Vulkan: LOD seems to be flawed, distance seems based on forward basis distance Nov 11, 2021
@Calinou
Copy link
Member

Calinou commented Nov 11, 2021

Related to #58513.

@chrisb123 Please upload a minimal reproduction project to make this easier to troubleshoot.

@chrisb123
Copy link
Author

Issues is obvious with less objects with significantly higher poly mesh count, but I can't upload a file that size.
The example provided just indicates higher primitive count when looking sideways.

@briansemrau
Copy link
Contributor

Sounds similar in nature to #52707. A similar fix could likely be applied.

@chrisb123
Copy link
Author

chrisb123 commented Nov 12, 2021

Possibly is similar in principal to the fog issue.
If you make the camera FOV higher it should highlight the issue better. You would see meshs at the edge of the screen with high LOD and when you rotate around the same mesh the same distance but in the centre of the screen will have a lower LOD.

@briansemrau
Copy link
Contributor

briansemrau commented Nov 12, 2021

The one difference between this and the fog issue is that fog should look spacially uniform, while LODs should generally be dependent on how much screen space they take up. The main purpose they serve is optimizing the situation when a mesh occupies so few pixels that you don't need to draw hundreds of triangles (and it may help reduce aliasing noise).

If a mesh is close along the view basis Z axis, even if spacially far away, it could actually be best to use a higher quality LOD. I haven't tested, so I don't have a recommendation.

@chrisb123
Copy link
Author

But very far away to the side ie completely off screen, it should be the the same as very far away when directly ahead.
The LOD increases the more to the side it gets and its not uniform, in the example provided the camera is placed in the centre looking at the ball grid, rotation to the left gives a very differ count then rotating to the right

@orosmatthew
Copy link
Contributor

As far as I know, doesn't Godot perform frustum culling? If so, I'm not sure if this should really be a problem as even if the LOD is higher when off to one side, the object wouldn't be rendered anyway if outside of the camera's frustum.

@Calinou
Copy link
Member

Calinou commented Jan 30, 2022

As far as I know, doesn't Godot perform frustum culling? If so, I'm not sure if this should really be a problem as even if the LOD is higher when off to one side, the object wouldn't be rendered anyway if outside of the camera's frustum.

Godot performs frustum culling, but some objects can have larger AABBs than expected.

@orosmatthew
Copy link
Contributor

FrustumLOD
Here's a top-down view of a scene. In case A, the LOD should be low as the z-distance to the camera is high. In case C, the LOD would be high as its z-distance to the camera is low, however, since it is outside of the frustum, it won't be rendered anyway. In case B, the AABB is still inside the frustum but the object itself is outside, however, if we can't trust the AABB to determine if the object is viewable inside the frustum, then I could only think of expensively looping through its geometry for a better calculation which I think would be unnecessary. The only problem I could then see is if a high LOD in case C would have any performance impact even if not being rendered which if is the issue here then the calculation for case C should be adjusted to show a low LOD. Is this the desired behavior?

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

Successfully merging a pull request may close this issue.

4 participants