glTF-Transform icon indicating copy to clipboard operation
glTF-Transform copied to clipboard

VRM Support

Open donmccurdy opened this issue 2 years ago • 6 comments

VRM is a file format focused on features relevant to humanoid character avatars. The format consists of extensions on top of the glTF file format, and could be implemented in glTF Transform as a set of extensions similar to @gltf-transform/extensions.

  • https://vrm.dev/en/
  • https://github.com/vrm-c/vrm-specification/tree/master/specification

donmccurdy avatar Oct 25 '23 01:10 donmccurdy

One note here as we're also looking into this: v0 is widely used, v1 is "official" now but seems to still be beta/in testing and is comparatively complex. v0 has lots of typos in the spec, very fun to work with...

hybridherbst avatar Oct 26 '23 15:10 hybridherbst

Somewhat related to this. Is there a way to turn off byteStride on export? I was able to read and write VRM0 with this super rough code and it works fine in ThreeJS.

https://github.com/donmccurdy/glTF-Transform/pull/1180/files#diff-9a9aab68c9cd82e5d7eeae7f9fd766aaf20558c7c9c7644fb8d55296936b277a

But UniVRM plugin does not handle these byteStrides really well. For the context, UniVRM is a Unity extension/package that allows apps to load VRM on runtime. And every VRM Unity app I found seems to use it. (See below)

F_2UZbvW0AA5fw5

We can use typings from @pixiv. But in my code I'm not sure how do that so I serialize most of them and only keep track of texture and node reference.

miramocha avatar Nov 27 '23 00:11 miramocha

@miramocha can you attach an example file? If the byteStride is missing they may simply be incorrect glTF files that are parsed by some more loosely checking implementations (or the ones where extra care has to be taken to read, strictly speaking, broken data).

(btw I'm also looking at VRM import/export support for UnityGltf, UniVRM has many issues)

hybridherbst avatar Nov 27 '23 22:11 hybridherbst

Probably byteStride here means interleaved vertex data? If you're using an application that doesn't support interleaved data, you can disable that with --vertex-layout separate in the CLI, or with .setVertexLayout on the IO classes:

  • https://gltf-transform.dev/modules/core/classes/PlatformIO#setVertexLayout

donmccurdy avatar Nov 27 '23 22:11 donmccurdy

That's the settings I'm looking for, thank you so much!!!! image

miramocha avatar Nov 27 '23 23:11 miramocha

@miramocha can you attach an example file? If the byteStride is missing they may simply be incorrect glTF files that are parsed by some more loosely checking implementations (or the ones where extra care has to be taken to read, strictly speaking, broken data).

(btw I'm also looking at VRM import/export support for UnityGltf, UniVRM has many issues)

If you are interested, they weren't supporting interleaved vertex until relatively recently here: https://github.com/vrm-c/UniVRM/pull/1949

and even that it's still bit buggy. ThreeVRM seems to support it perfectly fine though

miramocha avatar Nov 27 '23 23:11 miramocha