vrm-c / UniVRM

UniVRM is a gltf-based VRM format implementation for Unity. English is here https://vrm.dev/en/ . 日本語 はこちら https://vrm.dev/

Home Page:https://vrm.dev/en

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v0.119.0での正規化の処理順が逆な気がする

FujiSunflower opened this issue · comments

該当箇所

正規化処理後の頂点座標を入れたあとに、処理前の相対座標を計算しようとしている


vertices[j] = m.MultiplyPoint(vertices[j] - meshVertices[j]);

提案

ブレンドシェイプを先に格納してみる

            //
            // BlendShapes
            //
            {
                // var m = src.localToWorldMatrix; // include scaling
                // m.SetColumn(3, new Vector4(0, 0, 0, 1)); // no translation
                var m = Matrix4x4.TRS(Vector3.zero, src.transform.rotation, Vector3.one); // The mesh will scale by the GameObject
                CopyBlendShapes(src, srcMesh, mesh, m);
            }
            {
                // apply SkinnedMesh.transform rotation
                var m = Matrix4x4.TRS(Vector3.zero, src.transform.rotation, Vector3.one);
                mesh.ApplyMatrix(m);
            }

補足

メッシュ変更後のバウンディングボックスの再計算がされていなかったので、色々試したところUpdate When Offscreenを有効にして再計算を行うと良さそうでした。

上記の提案を手元のUnityで試したところ、表情変化(ブレンドシェイプ)によって変形するメッシュが顔から大きく飛び出してしまう問題が解決しました!ありがとうございます!

v0.119で発生していたまばたきする際に顔のメッシュが大きく飛び出す例
image