VRMKit
VRMKit copied to clipboard
VRM loader and VRM renderer (3D model / gltf)
VRMKit
VRM loader and VRM renderer


For "VRM", please refer to this page.
Features
- [x] Load VRM file
- [x] Render VRM models on SceneKit (experimental)
- [x] Face morphing (blend shape)
- [x] Bone animation (skin / joint)
- [x] Physics (spring bone)
Requirements
- Xcode 12+
- Swift 5.1+
- iOS 12.0+
Installation
Swift Package Manager (Recommended)
You can install this package with Swift Package Manager.
Carthage
github "tattn/VRMKit"
$ carthage update --platform ios --use-xcframeworks
CocoaPods
pod 'VRMKit'
pod 'VRMSceneKit' # for rendering
Usage
Load VRM
import VRMKit
let vrm = try VRMLoader().load(named: "model.vrm")
// let vrm = try VRMLoader().load(withUrl: URL(string: "/path/to/model.vrm")!)
// let vrm = try VRMLoader().load(withData: data)
// VRM meta data
vrm.meta.title
vrm.meta.author
// model data
vrm.gltf.jsonData.nodes[0].name
Render VRM
import VRMKit
import VRMSceneKit
@IBOutlet weak var sceneView: SCNView!
let loader = try VRMSceneLoader(named: "model.vrm")
let scene: VRMScene = try loader.loadScene()
let node: VRMNode = scene.vrmNode
sceneView.scene = scene
Blend shapes

node.setBlendShape(value: 1.0, for: .preset(.joy))

node.setBlendShape(value: 1.0, for: .preset(.angry))

node.setBlendShape(value: 1.0, for: .custom("><"))
Bone animation

node.setBlendShape(value: 1.0, for: .preset(.fun))
node.humanoid.node(for: .neck)?.eulerAngles = SCNVector3(0, 0, 20 * CGFloat.pi / 180)
node.humanoid.node(for: .leftShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)
node.humanoid.node(for: .rightShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)
Read the thumbnail image
let loader = try VRMSceneLoader(named: "model.vrm")
let image = try loader.loadThumbnail()
ToDo
- [ ] VRM shaders support
- [ ] Improve rendering quality
- [ ] Animation support
- [ ] VRM editing function
- [ ] GLTF renderer support
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Support this project
Donating to help me continue working on this project.
License
VRMKit is released under the MIT license. See LICENSE for details.
Author
Tatsuya Tanaka