This is a question / request for clarification, not a bug report.
Environments
- UniVRM version:
0.131.1 (com.vrmc.vrm + com.vrmc.gltf)
- Unity version:
Unity-2022.3.22f1
- OS:
Linux
Question
I export an avatar from an editor script using the static
UniVRM10.Vrm10Exporter.Export(GltfExportSettings settings, GameObject go, ...).
I set:
var settings = new GltfExportSettings
{
FreezeMesh = true,
FreezeMeshUseCurrentBlendShapeWeight = true,
};
byte[] bytes = Vrm10Exporter.Export(settings, root, null, null, meta);
expecting the avatar's current blendshape weights to be baked into the
exported mesh.
However, the exported VRM keeps the basis mesh — the current blendshape
weights are not baked, and the resulting glTF meshes have no (zero) morph
weights. Reading the source, Vrm10Exporter.Export calls
ModelExporter.Export(settings, ...) and does not appear to apply FreezeMesh;
the freeze / normalize / "bake blendshape" step seems to live only in the editor
export dialog path (Vrm10ExportDialog → Vrm10MeshUtility /
GltfMeshUtility / BoneNormalizer).
So my questions are:
-
Is it intended that the static/runtime Vrm10Exporter.Export does not
honor GltfExportSettings.FreezeMesh (and
FreezeMeshUseCurrentBlendShapeWeight), i.e. mesh freeze / normalize / blendshape
bake is editor-dialog only? If so, it would be great to document this, since
the fields living on GltfExportSettings make it look like the static Export
should apply them.
-
If it is editor-dialog only, is there a supported API to run the same
freeze (bake the current blendshape weights) from a script before/within
Export — e.g. via Vrm10MeshUtility? A minimal snippet would help a lot.
-
If it is not intended, would a change to honor these settings in the static
Export be welcome?
Minimal reproduction
- In a scene, set a
SkinnedMeshRenderer blendshape weight to 100.
- Call
Vrm10Exporter.Export(new GltfExportSettings { FreezeMesh = true, FreezeMeshUseCurrentBlendShapeWeight = true }, root, null, null, meta) from an editor script and write the bytes to a .vrm.
- The exported mesh is the basis (weight-0) shape; the glTF mesh/node
weights are zero.
Context
I'm building a small script-driven VRM 1.0 exporter that needs to bake the
avatar's current blendshape state (e.g. body-shrink shapes that hide skin under
clothes) into the exported mesh, without going through the GUI dialog. Possibly
related to #2041 (freeze pose with glTF export).
Thanks for the great library!
This is a question / request for clarification, not a bug report.
Environments
0.131.1(com.vrmc.vrm+com.vrmc.gltf)Unity-2022.3.22f1LinuxQuestion
I export an avatar from an editor script using the static
UniVRM10.Vrm10Exporter.Export(GltfExportSettings settings, GameObject go, ...).I set:
expecting the avatar's current blendshape weights to be baked into the
exported mesh.
However, the exported VRM keeps the basis mesh — the current blendshape
weights are not baked, and the resulting glTF meshes have no (zero) morph
weights. Reading the source,
Vrm10Exporter.ExportcallsModelExporter.Export(settings, ...)and does not appear to applyFreezeMesh;the freeze / normalize / "bake blendshape" step seems to live only in the editor
export dialog path (
Vrm10ExportDialog→Vrm10MeshUtility/GltfMeshUtility/BoneNormalizer).So my questions are:
Is it intended that the static/runtime
Vrm10Exporter.Exportdoes nothonor
GltfExportSettings.FreezeMesh(andFreezeMeshUseCurrentBlendShapeWeight), i.e. mesh freeze / normalize / blendshapebake is editor-dialog only? If so, it would be great to document this, since
the fields living on
GltfExportSettingsmake it look like the staticExportshould apply them.
If it is editor-dialog only, is there a supported API to run the same
freeze (bake the current blendshape weights) from a script before/within
Export— e.g. viaVrm10MeshUtility? A minimal snippet would help a lot.If it is not intended, would a change to honor these settings in the static
Exportbe welcome?Minimal reproduction
SkinnedMeshRendererblendshape weight to100.Vrm10Exporter.Export(new GltfExportSettings { FreezeMesh = true, FreezeMeshUseCurrentBlendShapeWeight = true }, root, null, null, meta)from an editor script and write the bytes to a.vrm.weightsare zero.Context
I'm building a small script-driven VRM 1.0 exporter that needs to bake the
avatar's current blendshape state (e.g. body-shrink shapes that hide skin under
clothes) into the exported mesh, without going through the GUI dialog. Possibly
related to #2041 (freeze pose with glTF export).
Thanks for the great library!