UniVRM Documentation

repository·master·Indexed 25 days ago

https://github.com/vrm-c/univrm

The 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.

Tokens
2.4K
Snippets
2
Records
26
Agent score
86%

What's inside UniVRM

  1. Import and export Unlit materials

    master

    UniGLTF-2.0 supports unlit materials with the following behaviors:

    • Importing: Uses the UniGLTF/UniUnlit shader.
    • Exporting: Supports exporting both UniGLTF/UniUnlit and standard Unity unlit materials.
    • Vertex Colors: Note that only the UniGLTF/UniUnlit shader supports vertex colors.
  2. Use DepthFirstScheduler for asynchronous task management

    master

    The DepthFirstScheduler is 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);
        ;
  3. Use ClothWarp components for cloth simulation

    master

    ClothWarp 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:

    1. ClothWarpRoot: Attached to the base of the physics object. It automatically registers descendant particles and applies base settings.
    2. ClothGrid: Adds horizontal constraints between adjacent Warps and enables triangle-based collision detection.
  4. Install UniVRM via UnityPackage

    master

    You can install UniVRM by downloading the appropriate .unitypackage files 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) or UniVRM_Samples-... (for VRM 0.x).

  5. Convert VRM 0.x models to VRM 1.0 using MigrateExporter

    master

    The MigrateExporter is 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.

  6. Install UniVRM via UPM Package

    master

    To 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.gltf AND com.vrmc.vrm.
    • For VRM 0.x: Install com.vrmc.gltf AND com.vrmc.univrm.
    • For glTF 2.0: Install com.vrmc.gltf only.
  7. Install and use UniGLTF-2.0

    master

    UniGLTF-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/releases