-
Notifications
You must be signed in to change notification settings - Fork 28
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
Dynamic LOD switching #324
Draft
sdumetz
wants to merge
33
commits into
Smithsonian:master
Choose a base branch
from
Holusion:perf_merged
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t's transform wouldn't be taken into account when calculating pick position
…n cases in comments
…t before it was added
…screen size as weight base
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So there is this idea_ I worked on for the past few months that makes it possible to open a ~200 models scene with each model having a 4k diffuse (in
High
quality) on a mobile device.It's still a very rough prototype but I wanted to share it and begin discussions on what requirements we'd have to meet for this to get merged into voyager.
This branch temporarily includes #266 to allow more camera mobility and a lot of performance patches that should be (or have been) extracted to their own PRs. It also needs to be rebased on Voyager's latest release. I'll do all this down the line as I clean everything up.
A working example is visible there:
https://lodtest.ecorpus.holusion.net/ui/scenes/Lascaux_retake2/view
Same model, without LOD (everything is squashed together and downscaled to a 8k diffuse map) is publicly available on the french ministry of culture website and takes longer to load initially, has a lot of blur and doesn't even work on most mobile devices.
I also have a simpler demo example that should clearly show what is happening:
https://lodtest.ecorpus.holusion.net/ui/scenes/simple_room/view
Reasoning
I started with 2 facts :
My objective was to be able to handle spatially large models. Things like a large painting, multi-figure sculpture or a whole room. In such an environment, I want what's right under my nose to have a very high texture resolution (abt. 4k for something filling the whole screen is a good upper bound) but on the other hand I don't care about the resolution of pretty much everything else.
Having a scene with 10s of objects, each with 4k diffuses tends to overload even desktop computers with low end discrete GPUs. I want to be able to have 100s of them.
How it works
I repurposed the existing
Derivative
system to dynamically switch models quality depending on the "perceived importance".Pretty much everything happens in the new CVDerivativeController class. The scene is initially loaded with
Thumb
quality (as it was before). Then the controller regularly sorts every model in the scene by importance (on-screen size and angle to camera are taken into account) and increments the quality of the most important model(s). If/When too much models are upgraded, it downgrades models as needed starting with the least important ones.Heuristics
Tradeofs that had to be made. Can and should be adjusted.
Performance
Estimating a performance budget is hard (see #254). Even if we could reliably determine a device's graphic power (we can't), we can't know if the user wants us to use 100% of his computer's power.
I settled somewhat arbitrarily on an initial budget of 2
High
resolution models that is then further decreased if we detect a low-end device (CPU count, RAM size, is a mobile device).Model weight
Models are weighted based on their size in camera space, their distance to the camera and their angle relative to the
Camera.forward
.The Distance modifier is somewhat redundant with size but we kinda want far away models to be less important even if they are very big. In fact most LOD algorithms are purely distance-based.