• Stars
    star
    1,241
  • Rank 37,857 (Top 0.8 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use VRM on Three.js

@pixiv/three-vrm

@pixiv/three-vrm on npm

Use VRM on three.js

three-vrm

GitHub Repository

Examples

Documentations

API Reference

v1

three-vrm v1 has been released!

three-vrm v1 supports VRM1.0, which is a new version of VRM format (the previous version of VRM is also supported, don't worry!). It also adopts the GLTFLoader plugin system which is a relatively new feature of GLTFLoader.

There are a lot of breaking changes! See the migration guide for more info.

How to Use

from HTML

You will need:

Code like this:

<!-- About import maps, see the Three.js official docs: -->
<!-- https://threejs.org/docs/#manual/en/introduction/Installation -->
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>

<script type="importmap">
  {
    "imports": {
      "three": "https://unpkg.com/[email protected]/build/three.module.js",
      "three/addons/": "https://unpkg.com/[email protected]/examples/jsm/",
      "@pixiv/three-vrm": "three-vrm.module.js"
    }
  }
</script>

<script type="module">
  import * as THREE from 'three';
  import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
  import { VRMLoaderPlugin } from '@pixiv/three-vrm';

  const scene = new THREE.Scene();

  const loader = new GLTFLoader();

  // Install GLTFLoader plugin
  loader.register((parser) => {
    return new VRMLoaderPlugin(parser);
  });

  loader.load(
    // URL of the VRM you want to load
    '/models/VRM1_Constraint_Twist_Sample.vrm',

    // called when the resource is loaded
    (gltf) => {
      // retrieve a VRM instance from gltf
      const vrm = gltf.userData.vrm;

      // add the loaded vrm to the scene
      scene.add(vrm.scene);

      // deal with vrm features
      console.log(vrm);
    },

    // called while loading is progressing
    (progress) => console.log('Loading model...', 100.0 * (progress.loaded / progress.total), '%'),

    // called when loading has errors
    (error) => console.error(error),
  );
</script>

via npm

Install three and @pixiv/three-vrm :

npm install three @pixiv/three-vrm

Code like this:

import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import { VRMLoaderPlugin } from '@pixiv/three-vrm';

const scene = new THREE.Scene();

const loader = new GLTFLoader();

// Install GLTFLoader plugin
loader.register((parser) => {
  return new VRMLoaderPlugin(parser);
});

loader.load(
  // URL of the VRM you want to load
  '/models/VRM1_Constraint_Twist_Sample.vrm',

  // called when the resource is loaded
  (gltf) => {
    // retrieve a VRM instance from gltf
    const vrm = gltf.userData.vrm;

    // add the loaded vrm to the scene
    scene.add(vrm.scene);

    // deal with vrm features
    console.log(vrm);
  },

  // called while loading is progressing
  (progress) => console.log('Loading model...', 100.0 * (progress.loaded / progress.total), '%'),

  // called when loading has errors
  (error) => console.error(error),
);

Contributing

See: CONTRIBUTING.md

LICENSE

MIT

More Repositories

1

ChatVRM

TypeScript
688
star
2

charcoal

Design system library by pixiv
TypeScript
313
star
3

go-thumber

dynamic JPEG thumbnailing proxy written in Golang
Go
293
star
4

Mux

https://pixiv.github.io/Mux/
C#
166
star
5

go-libjpeg

An implementation of Go binding for libjpeg (or libjpeg-turbo).
Go
156
star
6

webrtc

This is a fork of WebRTC made by pixiv Inc.
C++
111
star
7

ios-tutorial

iOSアプリ開発の学習用リポジトリ
Swift
109
star
8

zip_player

pixiv ugoira player
JavaScript
101
star
9

vroid-sdk-developers

forum for vroid sdk developers
93
star
10

charcoal-ios

Design system library by pixiv
Swift
59
star
11

go-libwebp

An implemantaion of Go bindings for libwebp.
Go
46
star
12

charcoal-android

Design system library by pixiv
Kotlin
29
star
13

gifsplit

gif animation frame extractor
C
24
star
14

intern2014w

19
star
15

musicvideo-generator

JavaScript
18
star
16

intern2015w

PHP
16
star
17

passport-pixiv

pixiv authentication strategy for Passport and Node.js.
JavaScript
15
star
18

.editorconfig

14
star
19

Mux.Markup.UI

https://pixiv.github.io/Mux/
C#
13
star
20

scalafix-pixiv-rule

Generic refactoring rules available in scalafix
Scala
13
star
21

VRoidHub-API-Example

TypeScript
12
star
22

Mux.Markup.Animation

https://pixiv.github.io/Mux/
C#
8
star
23

pixiv-novel-parser

pixiv-novel-parser
JavaScript
8
star
24

vrm-utils-rs

Utilities for handling the VRM format in rust.
Rust
8
star
25

pixiv-api-ruby-public

Ruby
8
star
26

omniauth-pixiv-public

Ruby
7
star
27

activerecord-dowsing

Ruby
4
star
28

ios-ci-salt-states

SaltStack
3
star
29

manga-segment

TypeScript
2
star
30

rzicon

pixiv-pro.com (distribute by heroku)
Ruby
2
star
31

lambda-pudding

AWS Lambdaを使って広告をバンディットアルゴリズムで最適化するインターン課題
JavaScript
2
star
32

ios-tutorial-api-mock

pixiv/ios-tutorial で使用するライブラリです
Swift
2
star
33

go-fluent-quicksilver

Faster log transfer to Fluentd
Go
1
star