-
Notifications
You must be signed in to change notification settings - Fork 1.3k
glTF-Draco JOINT attributes decoded as float, should be int #147
Comments
output_RF_comp_int.zip |
Looks good on https://gltf-viewer.donmccurdy.com/ (Draco support is now on by default) 👍 |
@lilleyse Fixed this here: CesiumGS/gltf-pipeline@5bcd878 I think this can be closed now. |
@FrankGalligan in the output_RF_comp_int.zip you attached above the POSITION accessor (80) has a count == 370 but Draco decoding is telling me that num_points() == 367. Why are these different? And (more of a spec question) if this is allowed why have an accessor at all for this attribute if it doesn't provide accurate data? |
From the current spec I would certainly assume If any of that is incorrect, the spec should likely be clarified. |
@donmccurdy so the count can be different for compressed and uncompressed meshes. But the count for compressed meshes we can get from the Draco decompressed mesh. So I'm proposing making this change to the spec: I also made a change to gltf-pipeline to output compressed and uncompressed fallback meshes here: |
I think the extension spec should be explicit about each of the accessor properties, in that case — if |
Draco does have its own metadata that provides that information in its bufferView. It seems during compression the bitstream can change the type of the vertex buffer as an option to the pipeline. I suggest we make clear in the extension that count, min, max, componentType and type are all correct in the accessor and match the data that draco would report from its bufferview decoding. |
Regarding I would agree with @najadojo that when fallback is present it should be filled with decompressed data instead of uncompressed data. In that case all properties will match in both versions. |
Oh, I'd missed that distinction between decompressed and uncompressed. Yes, having
Hm, assuming most users of the Draco extension are going to want to just use the encoder/decoder tools and not read the bitstream spec, where would they find that information? I'm not aware of API docs or an example that would give that info. Using THREE.DRACOLoader as a reference, I would assume the user of the decoder must know attribute types from an external source. |
Assuming that glTF properties are correct, loaders don't need to care about bitstream. Otherwise, they should be able to get all metadata from the decoder API (see IDL). |
Thanks — I see the Up until quite recently three.js assumed all draco attributes were float32 — we now rely on the glTF accessor componentType. It appears that BabylonJS still assumes float32. |
Here they are: |
@donmccurdy the method GetAttributeFloatForAllPoints converts each value to a float as it copies the decoded data to the JS array, its safe but inefficient. I believe all BabylonJS vertex attributes are Float32 when importing glTF so it always pays this cost. In our C++ engine I was hoping to use the accessor metadata to create the vertex data buffer first and then copy it at once via PointAttribute::buffer(). I could still do this but I'd need to refactor our loader such that the buffer creation is done later after we've determined if we are using Draco or not. |
Actually looking closer even if I had a guarantee from the accessor I'd still have to copy value by value because of the Point indices map. |
Does it mean that you won't care about |
No I still care very much. The whether or not the points are mapped or can be copied at once I still want to build our vertex buffers first. Doing that one way is best. |
So we can change the spec to say that the glTF accessor properties must match the decompressed data. E.g. in RiggedFigure then we would put "367" in the "accessor.count" For both cases where there was uncompressed fallback and when there wasn't. What about using the uncompressed fallback which has 370? Is this fine for loaders? |
No it wouldn't be if the fallback didn't contain 370 elements it wouldn't load. The compression pipeline should replace the input data with uncompressed data in the output so that the values would match. |
Ahh got it. Yes that should work. I'm fine with that. Sound good to everyone else? |
Yes, this is true. We can update it once the issues have converged. I've created a BabylonJS issue for this. |
I changed the PR for the spec to try and capture what we have been talking about. KhronosGroup/glTF#1343 Any comments? Should I add more detail? |
Currently I have 2 PRs related to this and gltf-pipeline. Once the text lands in the extension spec, I will start making PRs to gltf-pipeline main repo. Replace accessor properties with decompressed properties: Add support for decompressed data fallback: |
I think this was fixed a while ago. Can we close? |
From FrankGalligan#2 —
The text was updated successfully, but these errors were encountered: