poi’s tech blog

3D多人数同時接続型球体アクション成人向けゲーム開発のためのアイデア、ナレッジ

【未解決】Shape Keyを持つオブジェクトのSubdivision Surfaceモディファイアを削除後にglTF2.0エクスポートしたファイルがUnityにインポートできない

Blender 2.81a

1/19追記
自分の環境ではglTF2.0だとシェイプキー周りが上手く出力できなかったのでFBXに乗り換えました

poipoipoip.hatenablog.com

以下記事は参考程度にどうぞ

レンダリング用に有効にしていたSubdivision Surfaceを、glTF2.0エクスポートの際に削除した

f:id:poipoipoip:20200113141337p:plain
ローポリでエクスポートしたいのでSubdivision SurfaceをRemove

このメッシュオブジェクトは表情シェイプキーを複数持つ

f:id:poipoipoip:20200113141552p:plain
Relativeにチェック付けても付けてなくても今回の事象が発生する

f:id:poipoipoip:20200113141650p:plain
エクスポート時の設定

Unityに持っていく。あらかじめこのモジュールをUnity Projectにインポートしておく。

github.com

f:id:poipoipoip:20200113141819p:plain
先ほど作ったglbファイルをImport

Unityコンソールでエラーが出る。

import error: D:/BrenderProject/unity_kirby2.8/smart_kirby.glb
UnityEngine.Debug:LogErrorFormat(String, Object[])
UniGLTF.<>c__DisplayClass2_0:<ImportDelayed>b__0() (at Assets/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs:79)
UnityEditor.EditorApplication:Internal_CallDelayFunctions()
System.NotImplementedException: different targets: UniGLTF.glTFPrimitives with System.Collections.Generic.List`1[UniGLTF.gltfMorphTarget]
  at DepthFirstScheduler.Schedulable`1[T].ExecuteAll () [0x0003e] in D:\Unity_Projects\Blender 2.8 Test\Assets\VRM\DepthFirstScheduler\Schedulable.cs:119 
  at UniGLTF.ImporterContext.Load () [0x00008] in D:\Unity_Projects\Blender 2.8 Test\Assets\VRM\UniGLTF\Scripts\IO\ImporterContext.cs:438 
  at UniGLTF.gltfAssetPostprocessor+<>c__DisplayClass2_0.<ImportDelayed>b__0 () [0x00002] in D:\Unity_Projects\Blender 2.8 Test\Assets\VRM\UniGLTF\Editor\gltfAssetPostprocessor.cs:65 
UnityEngine.Debug:LogErrorFormat(String, Object[])
UniGLTF.<>c__DisplayClass2_0:<ImportDelayed>b__0() (at Assets/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs:80)
UnityEditor.EditorApplication:Internal_CallDelayFunctions()

Subdivision Surfaceモディファイアをメッシュオブジェクトにセットしたままエクスポートするとこのエラーは出ないが、Blend Shapeにシェイプキーが表示されなくなる。謎

その後…

SubsurfaceをRemove後、Shape Key全削除してExport→インポート出来るけどシェイプキーは当然無くなる

SubsurfaceをRemove後、Shape Key全削除してからShape Key作成してExport→同様のエラー

プロジェクトがバグってる?

誰か解決したら起こしてください。スヤァ

1/19追記
glTF2.0の思想は好きなんだけどBlenderから思い通りに出力できなくて挫折したのでFBXに浮気した。