Skip to content

Add BatchedMesh LOD and BVH example page #31239

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

agargaro
Copy link
Contributor

@agargaro agargaro commented Jun 7, 2025

Description

Hi! I've created an example that demonstrates how to manage LODs for BatchedMesh geometries, along with BVH acceleration for raycasting and frustum culling.

It's built using my @three.ez/batched-mesh-extensions library together with three-mesh-bvh by @gkjohnson.

@mrdoob Unlike the version published in X, here I also added raycasting and GUI.

You can check out the live demo here: https://agargaro.github.io/three.js/examples/webgl_batch_lod_bvh.html

Is that okay or should I create a different type of example?

@cmhhelgeson
Copy link
Contributor

cmhhelgeson commented Jun 7, 2025

Description

Hi! I've created an example that demonstrates how to manage LODs for BatchedMesh geometries, along with BVH acceleration for raycasting and frustum culling.

It's built using my @three.ez/batched-mesh-extensions library together with three-mesh-bvh by @gkjohnson.

@mrdoob Unlike the version published in X, here I also added raycasting and GUI.

You can check out the live demo here: https://agargaro.github.io/three.js/examples/webgl_batch_lod_bvh.html

Is that okay or should I create a different type of example?

This is really cool.

I think it would be neat if there was some way to see what the LODS closer to the horizon look like. Maybe a boolean settings like 'staticLOD' or 'freezeDistanceCalculation' that maintains the last stored distance from each mesh to the camera, such that when you move towards the back of the scene you can more clearly see how the LODs detail changes based on distance. Maybe my eyes are just bad and I just can't see the LODs for the farthest objects : )

@agargaro
Copy link
Contributor Author

agargaro commented Jun 8, 2025

I think it would be neat if there was some way to see what the LODS closer to the horizon look like. Maybe a boolean settings like 'staticLOD' or 'freezeDistanceCalculation' that maintains the last stored distance from each mesh to the camera, such that when you move towards the back of the scene you can more clearly see how the LODs detail changes based on distance. Maybe my eyes are just bad and I just can't see the LODs for the farthest objects : )

I could override the onBeforeRender method with an empty function, to avoid recalculation of the multidraw data. However, this would also disable frustum culling, resulting frozen.

@agargaro
Copy link
Contributor Author

agargaro commented Jun 8, 2025

I've added the freeze flag with latest commit.

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

Successfully merging this pull request may close these issues.

2 participants