vrm-c / UniVRM

UniVRM is a gltf-based VRM format implementation for Unity. English is here https://vrm.dev/en/ . 日本語 はこちら https://vrm.dev/
https://vrm.dev/en
MIT License
2.64k stars 424 forks source link

エクスポート時にブレンドシェイプを含むパーツが消える #396

Closed sorogonliy closed 4 years ago

sorogonliy commented 4 years ago

モデルのエクスポート時にブレンドシェイプを含むパーツになにか問題があるようでエラーになります。

fail to mesh.AddBlendShapeFrame Face.baked.上 UnityEngine.Debug:LogErrorFormat(String, Object[]) VRM.BoneNormalizer:NormalizeSkinnedMesh(Transform, Transform, Dictionary2, Boolean) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:443) VRM.BoneNormalizer:Execute(GameObject, Boolean, Boolean) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:557) VRM.VRMExportSettings:Export(String, List1) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:291) VRM.VRMExportSettings:Export(String) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:263) VRM.VRMExporterWizard:OnWizardCreate() (at Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs:42) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

ArgumentException: Blend shape frame weight must be greather than previous frame weight VRM.BoneNormalizer.NormalizeSkinnedMesh (UnityEngine.Transform src, UnityEngine.Transform dst, System.Collections.Generic.Dictionary2[TKey,TValue] boneMap, System.Boolean clearBlendShape) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:447) VRM.BoneNormalizer.Execute (UnityEngine.GameObject go, System.Boolean forceTPose, System.Boolean clearBlendShapeBeforeNormalize) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:557) VRM.VRMExportSettings.Export (System.String path, System.Collections.Generic.List1[T] destroy) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:291) VRM.VRMExportSettings.Export (System.String path) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:263) VRM.VRMExporterWizard.OnWizardCreate () (at Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs:42) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.ScriptableWizard.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/ScriptableWizard.cs:79) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336) UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:129) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401) UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511) UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307) UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176) UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245) UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

hiroj commented 4 years ago

ご報告ありがとうございます。 出来ればUnityのバージョン、使用したUniVRMバージョン、再現方法などを教えて頂けると助かります。

sorogonliy commented 4 years ago

追記 OS:Windows10 64bit Unity:2018.4.20.f1 UniVRM0.55.0

sorogonliy commented 4 years ago

再現方法 ①ヒエラルキー上に置いたモデルのプレハブアセットをクリック ②VRMタブからExport humanoidをクリック ③VRM Exporterウィンドウに必要事項を記載の上、Forse T PoseとPose Freezeのみにチェックを入れた状態でExportを押すとエラー

補足 Pose Freezeにチェックを入れない状態だと一応Exportされるが、二度目のExport時にPose Freezeにチェックを入れると同様にエラー発生。

sorogonliy commented 4 years ago

タイトルの説明に少し誤りがありました。 実際には「エクスポートされたVRMにブレンドシェイプを含むパーツが消えている」のではなく、そもそもこの状態ではエクスポートはエラーで実行されず、その代りヒエラルキー上に出てきたモデル名(normalized)という新たなプレハブにブレンドシェイプを含むパーツが反映されていないという現象が起きています。モデル名(normalized)のブレンドシェイプを含んでいたパーツはSkinned Mesh Rendererごと消えている状態です。

hiroj commented 4 years ago

情報ありがとうございます、調査してみます。

hiroj commented 4 years ago

ArgumentException: Blend shape frame weight must be greather than previous frame weight

とエラーが出ているため、おそらくMesh = Face.baked にある BlendShapeName = 上のブレンドシェイプに複数フレーム登録がされており、Normalize時にうまく変換が出来ていないようです。 Normalize処理が複数フレームブレンドシェイプに対応していなかったため、いったんこの部分の修正を行います。

hiroj commented 4 years ago

Forse T PoseとPose Freeze時に複数フレーム登録されているBlendShapeがコピーされるように修正を入れました #410. よろしければ動作確認をしていただけると助かります。

sorogonliy commented 4 years ago

返答が遅れてしまい申し訳ございません。 当方、素人のため基礎的なことをお聞きしたいのですが上記の修正を適用するには #410 のページのFiles changedの内容をBoneNormalizer.csを編集し反映すればよいのでしょうか。 Files changedの赤い行を削除し、そこに緑の行を挿入するというやり方で大丈夫でしょうか。 20200624174956

PoChang007 commented 4 years ago

はい、その方法は大丈夫ですが、 オススメのやり方は: このリポジトリをダウンロードする。 もしくはこのリポジトリからプルする。 ダウンロードしたフォルダをUnityでOpenする。

sorogonliy commented 4 years ago

試して見ましたが上手くいかないようでした。

fail to mesh.AddBlendShapeFrame Face.baked.上 UnityEngine.Debug:LogErrorFormat(String, Object[]) VRM.BoneNormalizer:NormalizeSkinnedMesh(Transform, Transform, Dictionary2, Boolean) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:443) VRM.BoneNormalizer:Execute(GameObject, Boolean, Boolean) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:557) VRM.VRMExportSettings:Export(String, List1) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:291) VRM.VRMExportSettings:Export(String) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:263) VRM.VRMExporterWizard:OnWizardCreate() (at Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs:42) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

ArgumentException: Blend shape frame weight must be greather than previous frame weight VRM.BoneNormalizer.NormalizeSkinnedMesh (UnityEngine.Transform src, UnityEngine.Transform dst, System.Collections.Generic.Dictionary2[TKey,TValue] boneMap, System.Boolean clearBlendShape) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:447) VRM.BoneNormalizer.Execute (UnityEngine.GameObject go, System.Boolean forceTPose, System.Boolean clearBlendShapeBeforeNormalize) (at Assets/VRM/UniVRM/Scripts/SkinnedMeshUtility/BoneNormalizer.cs:557) VRM.VRMExportSettings.Export (System.String path, System.Collections.Generic.List1[T] destroy) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:291) VRM.VRMExportSettings.Export (System.String path) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:263) VRM.VRMExporterWizard.OnWizardCreate () (at Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs:42) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.ScriptableWizard.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/ScriptableWizard.cs:79) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336) UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:129) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421) UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401) UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511) UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307) UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176) UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245) UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

PoChang007 commented 4 years ago

v56.2パッケージ使ってもインポートうまくいかなかったの場合は、インポートうまくいかなかったのモデル共有することは可能ですか?

私たち調査してみます。