-
Notifications
You must be signed in to change notification settings - Fork 481
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
gltfpack produces broken result for skinned parts of mesh #433
Comments
fwiw this looks as if the default number of bits (14) gltfpack uses for quantization isn't sufficient for this model. In certain cases this can be avoided by recentering the mesh, which gltfpack doesn't do automatically, but sometimes it's just something that needs to be raised via I'll keep this open for a bit because I need to check if gltfpack can improve this automatically by changing the mesh internally (which may be difficult for skinned model because right now gltfpack avoids doing any transforms on the skinned nodes due to three.js issues with culling), but using something like |
Right, so:
I think you don't see the issue in glTF-Transform because it's not quantizing the values, either because it just doesn't support quantization on skinned meshes, or because it requires an explicit command line instruction to enable that. Either way, I don't think this can realistically be fixed in quantization code, and propagating the scale value "into" mesh vertices would result in different bone transforms which may be important for other applications. |
P.S. The node with an abnormally high scale (100) that causes all this is Armature_S1/S2/S3. Maybe this is an artifact of a Blender export judging by the name, or maybe the source model is just configured in an odd way. |
I guess the one thing that gltfpack could do is compute two quantization grids, one for skinned meshes and one for non-skinned meshes... but it's a little silly to do that as it assumes that all or none of the skinned meshes in the model are poorly quantized due to abnormal scale values. If this example comes up in the future that could be a possible option but for now it feels like this shouldn't be handled by gltfpack. |
@zeux glTF Transform does quantize the vertex positions to 14 bits as well. I think the difference is that glTF Transform offers two quantization grids:
While 'mesh' may occasionally introduce seams where meshes are expected to align, I've found it mostly fine as a default. Comparing the two modes in glTF Transform:
I've exposed that flag to the CLI on the standalone
|
Yeah, seams are one reason why I've avoided per-mesh quantization. There's also issues with volume thickness (... this is really a spec issue in hindsight but oh well) in that if two meshes use the same material that has the extension, they need to use the same quantization scale. This also applies to skinning - since skinning matrices need to be adjusted, using a single skin for two meshes with different grids must also tie them together. This is all doable but cumbersome which is part of why I've been avoiding fixing this :) |
Upon closer inspection this doesn't solve this scene fully, as it has 2 unskinned meshes in addition to skinned meshes that have scale 100; they are smaller and harder to see but it would still be an issue. So besides using |
gltfpack -i CarbonFrameBike.glb -o CarbonFrameBike.packed.glb
Reference:
Using
-noq
works around the problem, but I thought it would be worth still raising an issue since the result looks relatively broken with default parameters.The text was updated successfully, but these errors were encountered: