Comments (6)
Do you feel this be an option on the bounds tree constructor or the raycaster, a la firstHitOnly
so it can be more easily used globally?
Constructor Option
geometry.computeBoundsTree({ intersectLeafNodesOnly: true });
// ...
geometry.intersectLeafNodesOnly = false;
Raycaster Option
raycaster.intersectLeafNodesOnly = true;
raycaster.intersectObjects( scene );
I'm thinking both options could be available and if the raycaster option is set to true
then it overrides the setting on the geometry bounds tree. The same thing could be added for firstHitOnly
so it's available as a constructor option, as well.
from three-mesh-bvh.
The default return value for a raycast hit includes the following values which won't all be available on a leaf node hit:
{
distance,
point,
face,
faceIndex,
object,
uv
}
I'm imagining face
, faceIndex
, and uv
all being set to null
in the case of a leaf node hit. Maybe an extra boolean value of leafNodeHit
or reference to the hit tree node can be included to indicate that triangles were not checked.
from three-mesh-bvh.
Lastly I'm expecting that the behavior when Raycaster.firstHitOnly = false
is to return the hits on all leaf nodes that the ray intersects. I'm not sure if there's a better option.
from three-mesh-bvh.
It seems to me like an option on the bounds tree to stop at leaf nodes and an option on the raycaster to only get the first intersection are independently useful and reasonable:
computeTruncatedBoundsTree
+firstHitOnly
= cheap construction, cheap raycast, get closest leaf node volume intersectedcomputeTruncatedBoundsTree
+!firstHitOnly
= cheap construction, more expensive raycast, get all leaf node volumes intersectedcomputeFullBoundsTree
+firstHitOnly
= same as in current implementationcomputeFullBoundsTree
+!firstHitOnly
= same as in current implementation
from three-mesh-bvh.
I agree there should be two different flags -- sorry I was unclear. My question was about whether or not there should be an "intersectLeafNodesOnly" flag on both the raycaster
and in the BVH constructor.
The flag on the BVH would mean that only that BVH would stop checking at the leafs. If it was set on the raycaster then the raycast would stop at the leaf on every bounds tree being cast against, like a global override. I think the flag in the constructor options is generally more flexible and has more utility so I vote for that until there's a need otherwise.
from three-mesh-bvh.
Tree construction and raycasting got way faster and more memory-efficient since we wrote this, and we think it can get even better, so I'm not sure it seems like a high priority anymore.
from three-mesh-bvh.
Related Issues (20)
- I encounter an unknown error when creating ParallelMeshBVHWorker in a Vite environment. HOT 3
- Iterative closest points algorithm implemantion using three-mesh-bvh HOT 1
- Adjusting bvh options in inspector demo seems to do nothing
- Triangle Painting - How does it work? HOT 1
- Some examples throwing an exception (Failed to construct 'URL') HOT 1
- StaticSceneGenerator: Fail gracefully when there's no geometry HOT 1
- StaticGeometryGenerator: Invert triangles if the scale is negative
- StaticGeometryGenerator: Simplify by using Mesh.getVertexPosition
- Help wanted. HOT 5
- StaticGeometryGenerator: Auto reset if geometry changes are detected
- StaticGeometryGenerator: Make handling of attributes more robust
- StaticGeometryGenerator: Support multimaterial meshes
- Does `MeshBVH.serialize` generate data for saving in `.bvh` file format? HOT 1
- Provide a CompoundMeshBVH class
- You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file HOT 1
- BVH Workers: sometimes the onProgress value is > 1 or never reaches 1
- Different results when intersect identical triangles. HOT 2
- Check the methods that use 'arrayToBox'.
- Add near and far check in intersectRay HOT 2
- Import error with NextJS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three-mesh-bvh.