-
Notifications
You must be signed in to change notification settings - Fork 12
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
Take the camera FOV into account for LOD calculations #2
Comments
@SIsilicon See OP:
I know this might be an unpopular opinion in today's LOD scene, but I stand by it 🙂 |
Don't know how I missed that in the post. 😅 |
Question though. How would that method be slow on high resolution games? |
@SIsilicon The method isn't necessarily slower depending on the viewport resolution, but the end result will be slower since higher quality LODs will be selected on higher resolutions (for a given distance). Lots of 4K displays have higher DPI compared to 1080p/1440p displays, making this high-quality LOD selection not as important as it theoretically should be. |
How would that be so? The screen coverage wouldn't be dependent on screen resolution, but rather by the percentage of the screen it covers. The result should theoretically be the same no matter what resolution is used. |
@SIsilicon I see… I always thought it was based on the number of pixels covered by the object (which would make it resolution-dependent). Either way, I'm not sure if Godot exposes everything required for that – a mesh's AABB may not be representative of its actual volume. This would also make LODSpatial only work for MeshInstance-derived nodes, rather than all Spatial-derived nodes. |
True. I decided to do a stress test with this method, and these were the results. These were from spawning 5000 static spheres in a 100x100x100 volume. |
The performance drop is likely due to nodes being included in the octree if they're still hidden. To prevent this, you need to remove nodes from the scene tree entirely using
That means I can't use exported properties anymore and have to override the much more complex |
I could benchmark that (later).
Trust me, it's not that complex once you get used to it. It was hard for me too at first, but now I use it all the time in my plugins, and it makes the plugin look more like part of the engine. 😁 |
One more thing. Distance Based LOD:
Screen coverage Based LOD:
|
It works with varying FOV if you take it into account during the distance checks 🙂 This is relatively easy to do, and is already done in many other engines (even id Tech 3 did it IIRC). As for orthogonal projection, do you need LOD in the first place when using it? Either way, I'd prefer supporting only distance-based LOD in this add-on to keep it simple. I appreciate the effort, but I'd rather avoid bloat if possible. This is especially the case since finding maintainers to fix bugs can be difficult. |
Zooming in and out in an isometric game for example.
I can be the maintainer. :) |
When the camera FOV decreases, the distances should be multiplied accordingly so distant objects still look detailed. The user-supplied camera distances will be specified for the default camera FOV (which is 70 in Godot 3.2.x).
There should be a project setting to disable this LOD adjustment in case it's not desired (e.g. for a game where the FOV is only changed for aesthetic reasons).
I've also considered using screen density-based LOD calculations, but they have an additional performance cost and some downsides (such as making high-resolution gaming even slower than it would be otherwise).
The text was updated successfully, but these errors were encountered: