-
Notifications
You must be signed in to change notification settings - Fork 19
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 for non-indexed and interleaved geometry #32
Comments
Merging is currently necessary. The BVH generation and the renderer expect a continuous, homogenous and non-indexed representation of the scenes geometry. Not very flexible or memory efficient, but it reduces the complexity when fetching the triangle data from a sampler in the pathtracing shader. gltf-transform as preprocess to transform the data into the expected form sounds great. But, as I need to disentangle the interleaved meshes anyways, I could also add dequantization... Conversely, does (de-)interleaving (vertex-)data sound like a useful functionality to have in gltf-transform? |
That's already available, added because some loaders don't support interleaved data. three.js supports interleaving of course, but certain packages (including three-mesh-bvh, until recently) don't, and so the option is configurable when writing a document with gltf-transform: import { WebIO, VertexLayout } from '@gltf-transform/core';
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
const io = new WebIO()
.registerExtensions(ALL_EXTENSIONS)
.setVertexLayout(VertexLayout.SEPARATE); // INTERLEAVED (default) or SEPARATE
const outputGLB = io.writeBinary(document); Perhaps there's a better term for it than 'separate'. 😅 |
Fixes two of the three problems reported in #32 Loader now supports - interleaved attributes - non-indexed (or mixed index and non-indexed?) - TODO: dequantization
Added gltf-transform to pre-process the input. Works as expected. |
Awesome, that was quick! I think the |
The renderer currently fails silently if given the following types of input geometry:
The error seems to be related to the
mergeBufferGeometries
step, which displays an error in the console. I'm not sure if it's possible to proceed without merging? three.js does have a mergeVertices utility that can help with creating an index. The other two (de-quantizing, de-interleaving) would require some custom code here.I'm wondering if it would be an option to pre-process the input glTF file with gltf-transform, to normalize the structure for the path tracer, like:
^the
dequantize
function doesn't yet exist, but I could add it if that's of interest.The text was updated successfully, but these errors were encountered: