-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Add example with high number of morph targets #22514
Conversation
I've created this example as draft because the model is currently quite large (3.9mb). I was able to shrink it down using gltfpack to just 325kb. However when I try to load it this is the result (animation plays correctly, lighting or normals are incorrect): This only occurs when I set scene.add(new THREE.HemisphereLight());
// scene.environment = texture; However if I drop back to r131 and re-able the environment it looks fine (except now the animation can only use 8 morphtargets) So it seems like the new morph target implementation is interacting badly with environment maps - but only when the model is compressed 😕 |
I would remove the environment map from the scene and use the more neutral |
Have you just tested with a hemisphere light? If so, try it again with an additional directional or point light. I assume the normals are corrupted in some way so these lights shouldn't work. |
Okay, the issue happens because |
Since the data texture needs to be of type Is it possible to configure gltf-pack such that morph data are not compressed? |
@mrdoob I can fix this if you want by doing this in if ( morphNormal.normalized === true ) {
const denominator = getMaxIntegerValue( morphNormal );
morph.x /= denominator;
morph.y /= denominator;
morph.z /= denominator;
}
If we don't apply the fix, users are not allowed to compress morph target data (this normally means representing morph normals as normalized signed integers) |
This model could be an option as well: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MorphStressTest I think it would be helpful to support normalized morph attributes, but am happy to help create a version of either model that doesn't include them if needed. |
plus 1 for using this model. The shapes it has are based on the Animoji FACS (based on my Gollum FACS from LOTR) I'd suggest skinning to some bones (w 4 bone linear skinning) so that the skinning, morph targets and normals are all on the same gpu loop. all three are required for character animation. doing just one in isolation makes no sense. Protip: the vertex positions and normal precision can be done as integers (i.e. pixel color) as long as they are scaled by the magnitude of largest vertex delta found in all the morph targets (and then rescaled before they are skinned). The visual fidelity loss us un-noticeable ;) this buys you the headroom to do 32 characters at once. my existence proofs: happy to skin up a neck to that mesh if it helps keep the test case legit. lemme know. |
Done, I've updated the live link. |
I don't think so. I tried making an uncompressed file by running @donmccurdy I did also try gltf-transform, both draco and meshopt. Draco barely reduced the filesize and meshopt completed messed up the model. I ran both commands with default settings, but didn't investigate any further yet. |
That'd be super useful! |
Ok thanks! Draco won't do anything with morph targets, but I would've expected meshopt to work. Filed a bug at donmccurdy/glTF-Transform#352. Glad to see #22516! |
draco not compressing the targets could be heavy depending how many verts are moving. storing the morph target/normals as a png could be a smart option. each 3 pixels being the unitized position of each vert in an index that gets expanded back to float on draw. that way draco image compression could compress the morph targets…. an idea. |
Draco cannot compress images, though. I think meshopt compression is the right choice here (this is what |
OK, I've switched to the gltfpack compressed model and marked this PR as ready for review. The normals will be incorrect until the builds are updated with #22516. |
@spiraloid giving the model a neck would be great 👍 I think I have the original FBX if that's easier for you to work from. |
Thanks! |
Added a new example to showcase simultaneous animation of a large number of morph targets.
Live link (note: normals incorrect pending build with #22516)
The model was kindly provided by the creator of the iPhone Face Cap app.
Possibly this example can replace webgl_morphtargets_horse as they serve a similar function.