-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
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
Examples: octree examples #27786
Examples: octree examples #27786
Conversation
89b90eb
to
2a66485
Compare
In this example, I used octree.rayIntersect and raycaster.intersectObject for comparison. Octree can maintain 60 frames in 60000 Mesh, while raycaster can only maintain 40 frames. ps: MacBook Pro Intel Core i7, AMD Radeon Pro 5300M 4 GB |
Thanks for you contribution but I'm not sure we need a separate Octree example in context of ray casting since we already have webgl_raycaster_bvh.
It's important to understand that |
For me, BVH might be too heavy, and I can efficiently accomplish ray casting using the built-in Octree. Moreover, I have numerous but relatively simple meshes, and I cannot effectively use When searching on Google, I found that the related information is about In summary, I think that |
For a line, let PointA be the first point of the line and PointB be the second point of the line. You can use the following code: const pointC = pointA.clone().add(pointB).multiplyScalar(0.5);
const triangle = new THREE.Triangle(pointA, pointB, pointC); For points, you can use the following code: const triangle = new THREE.Triangle(pointA, pointA, pointA); This allows you to use Octree for both lines and points, enabling efficient ray casting. This solution might be rough, but it indeed works well for my project. 😄 |
Sorry, but the example is not a worthwhile addition. The way it renders its objects potentially produce thousands of draw calls which degrades the performance to a minimum. This is no ideal setup for demonstrating the performance gains of spatial indices in context of ray casting. Moreover, we would not advocate users to render this kind of scene without instancing, batching or merging. If you want to demonstrate the performance benefits of spatial indices with ray casting, it's best to use a similar scene setup like webgl_raycaster_bvh. But as said above, there is currently no intention to further enhance or showcase |
Add octree examples