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

ViewerObjects: Sort the oct tree #52

Open
ApanLoon opened this issue Jan 4, 2023 · 1 comment
Open

ViewerObjects: Sort the oct tree #52

ApanLoon opened this issue Jan 4, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ApanLoon
Copy link
Owner

ApanLoon commented Jan 4, 2023

Is it plausible to do this for optimizing rendering of viewer objects?

  1. Sort each cell in the oct tree that contains all the ViewerObjects by the falling square size of the two largest dimensions of each object? (Only using the two largest dimensions means that very flat but otherwise large prims will be visible from a large distance)
  2. Then, before rendering (when the player moves?), loop through all the cells within view distance of the player
  3. For each cell, loop through all the ViewerObjects and compute something like "size / distance". It should be possible to map this value to the LOD range. Store this LOD value in the ViewerObject.

If this is a heavy operation, it should be possible to parallelize it by spreading out one or more cells to separate threads.

When all LODs has been calculated, the LOD of the GameObject that corresponds to each ViewerObject can be set and if the LOD value in the tree is is outside the LOD range, the GameObject will be disabled. This step probably has to be done in the main thread since that is the only one with access to the actual GameObjects.

@ApanLoon ApanLoon added the enhancement New feature or request label Jan 4, 2023
@ApanLoon
Copy link
Owner Author

ApanLoon commented Jan 4, 2023

Also, when a ViewerObject moves, i.e. is (re-)inserted into the oct tree, the LOD calculation should be updated based on the current player position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant