-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Support InterleavedBufferAttributes #147
Comments
+1 Really hope support for InterleavedBufferAttributes would land on the next release. |
I'd be happy to take a contribution that implements this and adds tests for interleaved attributes but unfortunately I don't have the time to work on this myself -- I just have too much else on my list. If you (or anyone else) are interested in working on this I'd recommend working off of the v0.4.0 branch which I'll hopefully be able to merge within the next few weeks and contains some significant changes to the BVH generation code. For this feature I'd want to ensure current benchmark timings minimally change if at all. Ideally there wouldn't have to be multiple code paths to support interleaved buffer attributes, too, but if the changes I suggested above lead to performance degradation I'd want to consider alternative solutions so that should be tested first. |
@Ben-Mack I was able to add support for interleaved position buffer attributes without degrading performance so that will be available in the next release. Interleaved index buffers are still not supported because it's a bit more complicated to add. Do any of your GLTF models use interleaved index buffers? The test compressed GLTF file in the three.js repo only includes interleaved position buffers so it's not clear to me if interleaved index buffers are all that common. If they're not then I'll plan to close this for v0.4.2. |
Thanks for the update! Maybe the model in this MeshOpt example is the one you looking for. |
Yes I'm aware of the three.js MeshOpt example and have already tested with that. But you wanted this feature so I'm asking if you could check the models you had problems with and let me know if they use interleaved buffer attributes for the index buffer. |
@gkjohnson Sorry for misunderstanding the prev question. I've tested on various models compressed using MeshOpt and three-mesh-bvh works perfectly fine. Again, Thanks a lot for this update! |
Great thanks! I'll close this, then, and if people need interleaved index attributes they can submit a new issues. |
Every for loop over attribute arrays needs to account for
attribute.stride
(default toattribute.itemSize
) andattribute.offset
(defaulting to 0).Change from something like this:
to
(performance and behavior should be verified)
TODO
Locations to Update
computeTriangleBounds
function (uses index, position buffers)refit
(position, index)Index Only
ensureIndex
function (uses position)buildTree
function (uses index)partition
(index -- the most complicated / problematic case because it tightly sorts values)Correctly Used
intersectsGeometry
function (uses position)closestPointToGeometry
(position, index)ThreeIntersectionUtilities
getRootRanges
(index)The text was updated successfully, but these errors were encountered: