All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- MeshBVHHelper not updating correctly
- StaticGeometryGenerator now inverts geometry winding order when a mesh uses negative scales.
- Minor case where outside bounds did not have floating point epsilon accounted for which could have resulted in missed intersections at the very edge of the bounds.
- The
MeshBVHHelper( mesh, depth )
constructor not working as expected. - The
validateBounds
function not accounting for the use of the "indirect" option.
- Added new "ParallelMeshBVHWorker" that parallelizes MeshBVH generation across multiple WebWorkers. Falls back to a single threaded approach if SharedArrayBuffer is not supported.
MeshBVHVisualizer
has been deprecated and renamedMeshBVHHelper
to align with three.js' conventions.MeshBVHHelper
constructor now optionally takes a bvh.- Organization of shader GLSL snippets. They are now grouped into the
BVHSShaderGLSL
object. Backwards compatible glsl snippets are provided for now but it's recommended to use the new location.
MeshBVHHelper
will now display correctly regardless of parent in hierarchy.MeshBVHHelper.copy
now correctly copies opacity, color.
- Small performance improvements to bvhcast function (up to ~10%).
- GPU function parameters to fix undefined behavior on some platforms.
- Case where indirect buffer with no index failed to raycast.
- Added support for draw range so the BVH now implicitly respects the start and end range specified in the geometry.
- An experimental "indirect" option to support an indirect triangle sorting for the BVH structure so the geometry index is not adjusted or implicitly generated.
- Fixed estimateMemoryInBytes not testing for SharedArrayBuffers resulting in a smaller memory footprint.
- Fixed bug in "intersectsGeometry" function.
- Removed long deprecated shapecast code path using old function signature.
- Removed long deprecated serialization code path using old function signature.
- Removed long deprecated "terminate" function from web worker class.
- Fixed another triangle / triangle intersection failure case.
- Type declaration and documentation for shapecast function.
- Fixed triangle / triangle intersection failure case.
- The root bounding box incorrectly including the origin causing an extra large bounds for shift geometry.
- Bumped minimum required three.js version to v0.151.0
- MeshBVH Worker error when incorrectly transferring shader array buffers.
- Case where raycasting would not work if uvs are not present.
- Support to suppress logs in
ExtendedTriangle.intersectsTriangle
.
- Removed use of optional chaining.
- Diff support to
StaticGeometryGenerator
so only changed meshes and skinned meshes are updated in order to improve performance on subsequent updates.
- StaticGeometryGenerator: now correctly only traverses and includes visible meshes.
- Support for distance queries on the GPU.
- Case in triangle intersect function that would incorrectly report an intersection.
- Case in new three.js that caused the vertex texture to work incrrectly.
- Removed incomplete and incorrect Box3 inheritance from OrientedBox.
- Adde
min
andmax
to typescript definition for OrientedBox.
- Support for normalized vertex attributes.
- Removed deprecated
MeshBVH
function signatures forraycast
,raycastFirst
,closestPointToPoint
,closestPointToGeometry
,refit
,intersectsGeometry
,shapecast
,intersectsBox
,intersectsSphere
.
- single point intersection in
intersectsTriangle
function. - issue in the
closestPointLineToLine
function.
- ExtendedTriangle: Fix Another case where IntersectsTriangle failed
- ExtendedTriangle: Fix Another case where IntersectsTriangle failed
- MeshBVHVisualizer: not removing child roots on update.
- ExtendedTriangle: Fix intersection not being reported when triangles intersect at vertex.
- MeshBVH.bvhcast: Fix bvhcast using incorrect bounds to traverse.
- "global" unnecessarily being used in the web worker.
- GenerateMeshBVHWorker.generate: reject when class has been disposed of or error is thrown in worker.
- GenerateMeshBVHWorker: ensure the root array buffers ate transfered when finishing construction.
StaticGeometryGenerator
to enable skinned and morph target mesh support.
- Incorrect return type for
computeBoundsTree
.
- Improved type definitions.
- GenerateMeshBVHWorker: Added "dispose" function. Deprecated "terminate" function.
- WebWorker BVH generation not accounting for geometry groups.
- Export and document "OrientedBox" and "ExtendedTriangle" classes for more clarity and enable use of internal mathematical functions.
- Case where
MeshBVH.closestPointToGeometry
would return an incorrect value. - Automatically dispose of textures on update instead of just "needsUpdate".
- Case where
SeparatingAxisTriangle.intersectsTriangle
would return incorrect intersection lines. Performance of the function improved as a side effect.
onProgress
callback now always reports1.0
when the BVH creation is complete instead of just passing intermmediate progress.
- Removed use of
RGBFormat
andRGBIntegerFormat
for compatibility with three.js r137.
- Improved SAH build time by ~20% by checking every triangle split once fewer than 8 triangles are present which also improves the split cost.
- GenerateMeshBVHWorker / MeshBVH: Add
onProgress
callback option to enable the ability to display BVH build percentage.
- MeshBVH.bvhcast incorrectly using the same geometry for both bvh.
shapecast
andbvhcast
types to be more correct.
- src/utils incorrectly being published as src/Utils in the previous release.
- Typescript definition files.
VertexAttributeTexture
,BVHStructUniform
, and associated helper shader functions for performing raytracing in a fragment shader.- Warning when passing in an unknown split strategy option value.
src/workers/GenerateMeshBVHWorker
to use a proper webworker syntax compatible with esm-capable bundlers.
useSharedArrayBuffer
option toMeshBVH
soSharedArrayBuffers
are created rather thanArrayBuffers
making it easier to share and reuse BVH memory across workers.- SeparatingAxisTriangle.intersectsTriangle: added
target
field to retrieve the edge describing the intersection. - "box" argument to shapecast "intersectsRange" function.
/* @__PURE__ */
indicator to reusable variables.
raycast
andraycastFirst
not properly accounting for material sidedness with geometry groups.- Case where the BVH root bounds would be incorrect if the geometry bounding box was incorrect / out of date.
- MeshBVH.closestPointTGeometry not returning a proper intersection point if triangles intersect.
- Shapecast function will now ensure a unique triangle / box is provided for each recursive call.
- Fix
GenerateMeshBVHWorker
not setting the geometry index correctly on return.
- Changed function signature for
intersectsGeometry
,shapecast
,intersectsBox
,intersectsSphere
,closestPointToGeometry
,closestPointToPoint
,raycast
, andraycastFirst
. Specifically at least the first "mesh" argument has been removed. Calling functions with the old signature will log a warning. See documentation for current signatures. raycast
andraycastFirst
now return hits in the local space of the geometry rather than world space when querying the BVH directly to conform with other cast functions. Results still match three.js' original results when usingRaycaster.intersectObject(s)
functions. See documentation for more details.MeshBVHDebug
class has been removed and the functiongetJSONStructure
andvalidateBounds
are now exported individually.- Small observed performance improvements possibly a result of simplified function arguments.
- The function signatures and options for
MeshBVH.serialize
andMeshBVH.deserialize
have changed. See documentation for more new signature. - Changed
refit
function to take just a single argument with traversed node indices. Calling the function with the old signature will log a warning. See documentation for current signature.
distanceToGeometry
anddistanceToPoint
functions.
- Fixed Surface Area Heuristic (SAH) split strategy to function correctly, improve build performance, and produce more optimal bounds and improved a memory footprint.
- Return "surfaceAreaCost" in returned
getBVHExtremes
object to compare BVH structure quality. - Support for
displayEdges
,meshMaterial
, andedgeMaterial
to MeshBVHVisualizer to enable displaying bounds as solid meshes.
- Deprecated the
getBVHExtremes
"total" return value in favor ofnodeCount
.
- Case where
intersectsRangeFunc
could be passed the incorrect node id in shapecast. - Bug in
distanceToGeometry
andclosestPointToGeometry
which would likely result in some closest points being missed. This fix greatly degrades performance in the case where the passed geometry does not have a BVH. It is recommended that the passed in geometry include a computed bounds tree. - Cases where passed in geometry that did not include an index buffer could throw an error when calling functions like
closestPointToGeometry
. - Case where raycastFirst would return the incorrect result.
- Greatly improved
MeshBVHVisualizer
render and update performance. - Case where MeshBVHVisualizer would not correctly display a BVH for geometry with multiple groups.
distanceToGeometry
andclosestPointToGeometry
fast path when the passed in geometry has a bounds tree.- Support for position BufferAttribute to be interleaved.
- package.json "main" field to use a .cjs file extension
MeshBVH.refit
function to refit the bounds to modified vertices.setBoundingBox
MeshBVH construction option.MeshBVH.getBoundingBox
function.intersectsRange
callback option toMeshBVH.shapecast
.
- Removed
src/worker/generateAsync.js
function. UseGenerateMeshBVHWorker
instead. - Use
type: module
in package.json to enable use of es6 modules in node. - Add
sideEffects: false
to package.json. - Remove ability to generate an unpacked BVH.
- Improved "closestPointToPoint" performance slightly.
MeshBVH.shapecast
to take an object of callback functions instead of a list of function arguments and the triangle intersection callback has been changed to take a single triangle index. See README for new API. Calls using the old function will log a warning.
MeshBVHVisualizer
not using the new geometry BVH if one was generated.MeshBVHVisualizer
not using the new mesh if it was set.- Case where passing in null
intersectsTriangleFunc
toMeshBVH.shapecast
could throw an error. - Case where the buffer being raycast against was not cleared correctly if a BVH had multiple roots.
- Include built umd file including v0.3.6 changes.
- Incorrect face index would be returned from intersection (related to three.js bug fixed in v0.126.1).
- Case where
raycastFirst
failed to return a valid result.
- Raycast result to return a custom intersection object aligned with three.js v0.126.0.
depth
argument tointersectsBoundsFunc
andintersectsTriangleFunc
ofshapecast
.- "webvr" and "webxr" tags.
closestPointToSegment
function to the triangle object used during shapecast which can be used for capsule intersection detection.
- Case where float 32 rounding error could result in leaf bounds not completely containing the triangles by expanding the bounds by an estimation of the error.
Shapecast
intersectsBoundsFunc
to return one of theNOT_INTERSECTED
,INTERSECTED
, orCONTAINED
constants. Returningtrue
andfalse
currently retains the old functionality.
- Performance improvements when computing distance to geometry.
shapecast
to the docs.MeshBVHVisualizer
to exports.
- Cloning the bvh visualizer causing an error.
- Bug with shapecast function where one node would not be checked when using the node score function.
- Change the bvh visualizer so it automatically copies the local position and rotation of the target mesh.
generateAsync
function in the/src/worker
folder to help generate BVHs asynchronously with WebWorkers.
- three.js version to use v0.123.0, change
Matrix4.getInverse
toMatrix4.invert
.
- MeshBVH.serialize and deserialize functions so the bvh can be computed and transferred from a webworker.
lazyGeneration
(defaults to true) option for faster tree initialization.- Support for a buffer-packed tree if
lazyGeneration
is false or a tree has been deserialized for a more smaller memory footprint.
- CENTER tree computation to improve raycast performance and create more balanced trees.
- Uglify warning for inline defined functions.
- Changed three.js peer dependency version from ^ to >= to prevent warnings.
- Use the BufferGeometry bounding box if it exists and set it if it does not.
- Use the center of the triangles bounding box instead of the average of the vertices as the triangles center when binning the polygons.
- Bug where
closestPointToGeometry
would throw an error when target vectors were provided because a function name was misspelled.
- API for performing intersecting boxes, spheres, and geometry.
- API for checking the distance to geometry and points.
- Fixed issue where an index buffer of the incorrect type was created if there were more than 2^16 vertices.
- Fixed MeshBVHVisualizer not visualizing all the groups in the bvh.
- Error conditions when using
InterleavedAttributeBuffers
for both index and position geometry attributes. - The geometry index attribute is modified when building the
MeshBVH
. And index attribute is created on geometry if it does not exist.
- Fix the bounds tree not respecting groups
- Add included files array to package.json.