Skip to content

Add VRM1.0 rendering#47

Merged
tattn merged 5 commits into
tattn:feature/vrm10-renderfrom
soramikan:add-vrm10-render
Jun 26, 2026
Merged

Add VRM1.0 rendering#47
tattn merged 5 commits into
tattn:feature/vrm10-renderfrom
soramikan:add-vrm10-render

Conversation

@soramikan

Copy link
Copy Markdown
Contributor

Summary

Closes #27

  • Add native VRM 1.0 rendering support for both SceneKit and RealityKit paths.
  • Stop relying on VRM1 -> VRM0 migration data for runtime rendering features where VRM1 has different binding semantics.
  • Wire VRM1-specific humanoid, expressions, first-person annotations, spring bones, node constraints, thumbnails, and MToon material handling.

Details

  • Add VRM1 expression runtime clips, including VRM1 preset names and VRM0-compatible aliases.
  • Resolve VRM1 morph target binds by node index instead of migrated mesh indices.
  • Apply VRM1 material color binds, and SceneKit texture transform binds.
  • Load VRM1 MToon / unlit materials directly from glTF extensions, including render queue and transparentWithZWrite behavior.
  • Add native VRM1 SpringBone support with collider groups, capsule colliders, and per-joint settings.
  • Add runtime support for VRMC_node_constraint roll / aim / rotation constraints with dependency ordering.
  • Fix VRM1 thumbnail loading to use meta.thumbnailImage as an image index.
  • Update humanoid setup for VRM1 bone definitions.

Validation

  • swift build --scratch-path /private/tmp/VRMKit-build
  • swift test --scratch-path /private/tmp/VRMKit-build
  • git diff --check
  • Manually confirmed that a VRM 1.0 model renders correctly in the sample app.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds comprehensive support for VRM 1.0 features across VRMKit, VRMRealityKit, and VRMSceneKit, including humanoid setup, first-person render modes, node constraints, and updated spring bone and collider configurations. The feedback highlights several critical areas for improvement: validating metadata-derived indices before direct array subscripting to prevent out-of-bounds crashes, guarding against division-by-zero or NaN values in spring bone calculations when joint and parent positions overlap, and safely handling potential duplicate keys during dictionary initialization for node constraints to avoid runtime crashes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Sources/VRMKit/VRMLoader.swift Outdated
Comment thread Sources/VRMRealityKit/VRMEntityLoader.swift Outdated
Comment thread Sources/VRMSceneKit/VRMSceneLoader.swift Outdated
Comment thread Sources/VRMRealityKit/VRMEntityLoader.swift Outdated
Comment thread Sources/VRMRealityKit/CustomType/VRMEntitySpringBone.swift
Comment thread Sources/VRMSceneKit/CustomType/VRMSpringBone.swift
Comment thread Sources/VRMRealityKit/CustomType/VRMEntity.swift Outdated
Comment thread Sources/VRMSceneKit/CustomType/VRMNode.swift Outdated
@tattn

tattn commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Thank you for the PR!
When checking the rendering in SceneKit, it appears to be broken. Could you please check the display for each pattern and confirm that there are no regressions?

Left:main branch | Right:this branch

main br

@soramikan

Copy link
Copy Markdown
Contributor Author

Thank you for checking this.

I'm sorry that I didn't visually check if the display was correct in SceneKit.

I confirmed the SceneKit regression. The cause was that the VRM1 MToon handling change made existing VRM0 SceneKit materials use PBR lighting, which caused Alicia to render with the metallic-looking appearance in the screenshot.
I fixed it by keeping VRM0 SceneKit materials on constant lighting while preserving the VRM1 PBR/MToon behavior. I also added a regression test to ensure Alicia's VRM0 materials remain constant-lit.

I also updated MacExample so it can switch between SceneKit and RealityKit, and added the same expression controls there so both renderers can be compared more easily.

@soramikan

Copy link
Copy Markdown
Contributor Author
スクリーンショット 2026-06-26 12 33 45 スクリーンショット 2026-06-26 12 33 51

@tattn

tattn commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Thank you for addressing the review comments and improving the samples.

The code looks good as well, so I’ll merge it into the feature/vrm10-render branch for now, make some adjustments such as API design refinements, and then merge it into the main branch.

Thanks again for all your hard work!

@tattn tattn changed the base branch from main to feature/vrm10-render June 26, 2026 13:12
@tattn tattn merged commit e520249 into tattn:feature/vrm10-render Jun 26, 2026
5 checks passed
tattn added a commit that referenced this pull request Jun 26, 2026
@soramikan soramikan deleted the add-vrm10-render branch June 27, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any plan to support new version of VRM?

2 participants