Skip to content

Question: does runtime Vrm10Exporter.Export intentionally ignore GltfExportSettings.FreezeMesh / FreezeMeshUseCurrentBlendShapeWeight? #2805

Description

@m96-chan

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 (Vrm10ExportDialogVrm10MeshUtility /
GltfMeshUtility / BoneNormalizer).

So my questions are:

  1. 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.

  2. 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.

  3. If it is not intended, would a change to honor these settings in the static
    Export be welcome?

Minimal reproduction

  1. In a scene, set a SkinnedMeshRenderer blendshape weight to 100.
  2. Call Vrm10Exporter.Export(new GltfExportSettings { FreezeMesh = true, FreezeMeshUseCurrentBlendShapeWeight = true }, root, null, null, meta) from an editor script and write the bytes to a .vrm.
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions