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

Frustum culling #77

Closed
Ralith opened this issue May 8, 2020 · 3 comments · Fixed by #99
Closed

Frustum culling #77

Ralith opened this issue May 8, 2020 · 3 comments · Fixed by #99
Labels
enhancement New feature or request good first issue Good for newcomers performance Something's slower than it should be

Comments

@Ralith
Copy link
Owner

Ralith commented May 8, 2020

We can massively reduce the amount of vertex processing done on the GPU with a relatively simple frustum culling check per terrain chunk.

@Ralith Ralith added enhancement New feature or request performance Something's slower than it should be good first issue Good for newcomers labels May 8, 2020
@Ralith
Copy link
Owner Author

Ralith commented May 9, 2020

This could potentially be GPU-accelerated as well. For example, we could store a transform relative to the view node with every GPU-resident chunk, then use a compute shader to emit an indirect draw command for zero or one instances of each. It's unclear if this would be worth the additional complexity of maintaining that transform list, though.

@Ralith
Copy link
Owner Author

Ralith commented May 15, 2020

We can actually use this to accelerate the graph traversal to collect in-view nodes and therefore drastically reduce the number of chunks that need to be considered for culling. This is as simple as ignoring neighbor nodes which fail the frustum test. If the reference graph described in #55 is implemented, the geometric character of the graph could be further leveraged by ignoring neighbors with shorter distance to the view node outright. Furthermore, fine-grained per-chunk frustum tests only need to be performed within nodes that overlap the frustum boundary.

The frustum test itself can be implemented in terms of bounding spheres, using the same point vs. plane signed distance formula we use to judge distance from the reference plane in terrain generation.

@Ralith
Copy link
Owner Author

Ralith commented May 17, 2020

We probably shouldn't actually frustum-cull the graph traversal, since loading nearby chunks that aren't in view is desirable to limit pop-in when the view rotates quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers performance Something's slower than it should be
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant