loader/vrm: add VRM/GLB loader#321
Open
raa0121 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new
loader/vrmpackage that loads VRM and GLB files.VRM is a glTF 2.0–based file format for 3D humanoid avatars, widely used for
VTuber / metaverse applications. The package is derived from the existing
loader/gltfpackage and extends it with the handling required to renderrigged VRM avatars correctly.
What's included
loader/vrmwith the following files:loader.go— glTF/GLB parsing and scene/node/mesh/material loadingvrm.go— glTF + VRM type definitionsmaterial_pbr.go— PBR (metallic-roughness) material loadingmaterial_common.go— common/legacy material loadinglogger.go— package loggerloader/gltf:ParseJSON/ParseJSONReader— load.gltf(JSON)ParseBin/ParseBinReader— load.glb/.vrm(binary)(*GLTF).LoadScene,LoadNode,LoadMesh,LoadSkin,LoadAnimation,LoadMaterial,LoadTexture,LoadImageKey differences from loader/gltf
graphic.NewRiggedMeshand wired to theirgraphic.SkeletonviaSetSkeleton, including the multi-primitive case (each primitive gets itsown
RiggedMeshsharing the same skeleton). This is what makes riggedhumanoid VRM models render and animate correctly.
VRMextension andKHR_materials_unlitare recognized; unlit is treated as advisory and fallsback to PBR data.
Notes / open questions for maintainers
loader/gltf, to avoid changing existing glTF behavior. Happy to discussmerging the skinned-mesh fix back into
loader/gltfif preferred.TODOs remain (e.g. viewport aspect ratio for cameras), carried overfrom the gltf loader.
.vrm/.glbavatars. No automatedtests or demo program are included in this PR — guidance welcome on what the
project would like to see here.
example