UniVRM Documentation
repository·master·Indexed 25 days ago
https://github.com/vrm-c/univrmThe standard implementation of the VRM 3D avatar file format for Unity. UniVRM provides support for importing and exporting VRM 1.0, VRM 0.x, glTF 2.0, and VRM-Animation assets at runtime and in the editor. It includes UniGLTF for glTF 2.0 workflows, the MToon toon shader, UniHumanoid for humanoid utilities, and a cloth simulation system featuring ClothWarp and ClothGrid. The library also provides the DepthFirstScheduler for asynchronous task management and UniJSON for serialization.
What's inside UniVRM
- MToon is a toon shader designed for Unity that supports Unity Global Illumination. It is used to achieve a stylized, anime-like appearance within Unity environments.
Use UniVRM for VRM and glTF workflows
masterUniVRM is the core library for handling VRM and glTF assets in Unity. It provides tools for importing/exporting glTF 2.0, managing VRM-specific extensions (such as BlendShape, FirstPerson, LookAt, and Meta), and handling humanoid utilities.Use SphereTriangle for sphere-triangle collision detection
masterSphereTriangle is a utility library designed to handle collision detection between spheres and triangles. It is provided as a sample/component within the UniVRM ecosystem.Import and export glTF PBR materials
masterUniGLTF-2.0 provides conversion between glTF PBR (Physically Based Rendering) materials and the Unity Standard Shader. It handles the conversion of metalness, roughness, and occlusion RGBA channel incompatibilities.Import and export Unlit materials
masterUniGLTF-2.0 supports unlit materials with the following behaviors:
- Importing: Uses the
UniGLTF/UniUnlitshader. - Exporting: Supports exporting both
UniGLTF/UniUnlitand standard Unity unlit materials. - Vertex Colors: Note that only the
UniGLTF/UniUnlitshader supports vertex colors.
- Importing: Uses the
Use DepthFirstScheduler for asynchronous task management
masterThe
DepthFirstScheduleris an asynchronous task scheduler designed for Unity (5.6 or later) that builds a tree structure of tasks and executes them using a depth-first traversal. It allows you to specify different execution schedulers (such as the Unity main thread or a thread pool) for different stages of your task tree.var schedulable = new Schedulable<Unit>(); schedulable .AddTask(Scheduler.ThreadPool, () => // Add a child task { return glTF_VRM_Material.Parse(ctx.Json); }) .ContinueWith(Scheduler.MainThread, gltfMaterials => // Add a sibling task { ctx.MaterialImporter = new VRMMaterialImporter(ctx, gltfMaterials); }) .Subscribe(Scheduler.MainThread, onLoaded, onError); ;Use ClothWarp components for cloth simulation
masterClothWarp is a development version of UniVRM's cloth system. It works by connecting vertical threads (
Warp) horizontally to create a square grid (Grid). This allows colliders (Sphere/Capsule) to prevent passing through the gaps between threads using triangle-based collision detection.The system uses two main components:
- ClothWarpRoot: Attached to the base of the physics object. It automatically registers descendant particles and applies base settings.
- ClothGrid: Adds horizontal constraints between adjacent Warps and enables triangle-based collision detection.
Install UniVRM via UnityPackage
masterYou can install UniVRM by downloading the appropriate
.unitypackagefiles from the latest release. Choose the package based on the file formats you need to support:- VRM 1.0 support: Download
VRM-0.XXX.X-YYYY.unitypackage. - VRM 0.x support: Download
UniVRM-0.XXX.X-YYYY.unitypackage. - glTF 2.0 support: Download
VRM-0.XXX.X-YYYY.unitypackage.
Sample projects are also available as
VRM_Samples-...(for VRM 1.0) orUniVRM_Samples-...(for VRM 0.x).- VRM 1.0 support: Download
Convert VRM 0.x models to VRM 1.0 using MigrateExporter
masterThe
MigrateExporteris a runtime tool designed to convert exported VRM 0.x models directly into VRM 1.0 binary format. This process uses a VRM 0.x hierarchy combined with VRM 1.0 metadata as input to produce a valid VRM 1.0 output.To ensure a successful migration, the initial VRM 0.x export must be performed with specific settings:
- Do not normalize (正規化しない)
- Maintain Z+ or Left-handed coordinate systems (z+ もしくは 左手系のまま)
- Use divided vertex buffer (implemented for GLB)
During the migration phase, VRM 1.0 metadata can be injected from an external source. This allows for a 'complete' VRM 1.0 output without requiring manual user input during the migration process. The resulting output is subject to VRM 1.0 validation.
Install UniVRM via UPM Package
masterTo install UniVRM using the Unity Package Manager (UPM), use the
Add package from git URL...option in the Unity Editor. You must install specific packages depending on your required functionality:- For VRM 1.0: Install
com.vrmc.gltfANDcom.vrmc.vrm. - For VRM 0.x: Install
com.vrmc.gltfANDcom.vrmc.univrm. - For glTF 2.0: Install
com.vrmc.gltfonly.
- For VRM 1.0: Install
Install and use UniGLTF-2.0
masterUniGLTF-2.0 allows you to import and export glTF-2.0 assets in both the Unity Editor and at runtime. It supports Unity versions 2019.4 and later.
To download the latest releases, visit the official GitHub releases page.
https://github.com/vrm-c/UniVRM/releasesLicense requirements for MigrateExporter
masterWhen usingMigrateExporterto convert models, you must possess the legal right to change the license of the targetvrm-0.xmodel.