Modular Avatar Documentation

repository·main·Indexed 21 days ago

https://github.com/bdunderscore/modular-avatar

A suite of non-destructive tools for Unity-based avatar creators to modularize avatars and distribute components. It enables adding outfits and gimmicks via drag-and-drop by automatically merging armatures and animators into a parent avatar. Key features include MA Outfit Root, MA Blendshape Sync with curve mapping, Mesh Cutter for hiding mesh parts, and MA Fit Preview for real-time testing in Edit Mode.

Tokens
35.3K
Snippets
21
Records
249
Agent score
70%

What's inside Modular Avatar

  1. Overview of Modular Avatar

    main

    Modular Avatar is a suite of non-destructive tools designed for modularizing avatars and distributing avatar components. It simplifies the process of adding outfits or gimmicks to an avatar to a simple drag-and-drop operation.

    Key capabilities include:

    • Armature Merging: Merges prefab armatures into the parent avatar (common for outfits) while minimizing new bone creation by reusing existing bones.
    • Animator Merging: Merges subcomponent animators into the parent avatar, facilitating the implementation of various avatar gimmicks.
    • Non-destructive Workflow: Allows for modular additions without permanently altering the base avatar structure.
  2. What is the PhysBone Blocker and when to use it

    main

    The PhysBone Blocker is a component used to prevent PhysBones rooted in parent objects from affecting a specific child object. It achieves this by automatically adding the child object to the Ignore list of any PhysBone that affects its parent.

    Use Cases

    • Accessories on PhysBone chains: Use it when creating accessories (like clothing or items) that a user might attach to an existing PhysBone chain (such as a tail, ear, or hair). This prevents the movement of the parent chain from causing unwanted physics jitter or movement on the attached accessory.
    • Rigid attachment with Bone Proxies: When using a Bone Proxy component to attach an object to a pre-existing PhysBone chain, adding a PhysBone Blocker ensures the object remains rigidly attached to the parent chain without being influenced by the parent's physics simulation.
  3. What is Outfit Root and how to configure it

    main

    The Outfit Root component identifies the root GameObject of an outfit. While it is typically added automatically via the Setup Outfit tutorial, you may need to add it manually in some cases.

    If adding it manually:

    1. Add the Outfit Root component to your outfit's root GameObject.
    2. Set the Armature Root field to the root Transform of the outfit's main bone hierarchy.

    Outfit Root acts as a marker for other Modular Avatar tools and provides a centralized interface for outfit adjustment options.

  4. What is Bone Proxy and when to use it

    main

    The Bone Proxy component allows you to place objects from your prefab inside existing objects (like bones) of the original avatar. It automatically adjusts any animators that reference the old location of the objects so they point to the new paths after the move.

    Use Cases

    • When to use: When you need to place prefab objects (like contacts or colliders) inside specific bones of an avatar.
    • When NOT to use: Do not use Bone Proxy for configuring clothing; use Merge Armature instead.
  5. Use Blendshape Sync to synchronize shapekeys

    main

    The Blendshape Sync component ensures that a specific blendshape on one renderer always matches the value of a blendshape on another renderer.

    Use Cases

    • Outfits: Syncing an outfit's shapekeys to match the body's shapekeys (e.g., for body adjustments).
    • Base Avatars: Syncing blendshapes between different objects within the same avatar.

    Limitations

    • No Chaining: You cannot chain syncs (e.g., A $\rightarrow$ B and B $\rightarrow$ C is not supported; you must go A $\rightarrow$ B and A $\rightarrow$ C).
    • No Multi-level Sync: It does not support syncing through multiple levels of objects (A $\rightarrow$ B $\rightarrow$ C).
    • Animator Requirement: At runtime, it only supports blendshapes controlled by animators. It cannot accurately sync blendshapes controlled by VRChat's built-in eyelook or viseme systems.
  6. Configure Layer Priority and Merge Mode

    main

    Layer Priority

    Layer Priority determines the order in which multiple Merge Animators are applied to the final animator.

    • Layers are applied in increasing order of priority (lower numbers are applied first; higher numbers override them).
    • If multiple Merge Animators have the same priority, they are applied in the order they appear in the hierarchy.
    • Pre-existing animator layers are considered to be at priority zero, appearing before any priority-zero Merge Animators.

    Merge Mode

    • Default: Adds the animator to the specified layer.
    • Replace Existing Animator: Replaces the animator configured on the VRChat Avatar Descriptor with the one you provide. The replaced animator retains its specified priority but is applied before any other Merge Animators at that same priority level.

    Warning: Having multiple Merge Animators set to the same Layer Type and Replace Existing Animator mode will result in an error.

  7. Use Shape Changer to modify blendshapes

    main

    The Shape Changer component is a reactive component used to modify the shape keys (blendshapes) of a target renderer on an avatar. It is primarily used on outfit meshes to hide or shrink parts of the base avatar model that are covered by clothing to prevent clipping or interference.

    When to use it:

    • On outfit meshes to hide/shrink base model parts.

    When NOT to use it:

    • Do not use it to modify blendshapes that are already being animated by other animations. Instead, animate the on/off state of the GameObject containing the Shape Changer component.
  8. Use Vertex Filter - By Mask to select mesh portions

    main

    The Vertex Filter - By Mask component is a specialized vertex filter used in conjunction with a Mesh Cutter component. It allows you to select specific portions of a mesh to delete or hide based on the grayscale values of a mask texture.

    To function, it requires a Mesh Cutter component on the same GameObject. The filter uses the texture's color data to determine which polygons are affected.

  9. Reaction timing and frame delays

    main

    Reactive components respond to GameObject state changes with a one frame delay.

    When one reactive component controls the state of another (a chain reaction), a one frame delay is applied to each component individually. For a chain A -> B -> C, if A is turned off, the timing is:

    • Frame 1: Nothing happens (A's disable is delayed).
    • Frame 2: A is disabled (B's disable is delayed).
    • Frame 3: B and C are disabled at the same time.

    Warning: Do not rely on exact timing for complex effects, as the implementation timing may change in future optimizations.

  10. Use Mesh Cutter to modify meshes

    main

    Mesh Cutter is a reactive component used to delete or hide specific parts of a mesh based on vertex filters. It is useful for:

    • Removing mesh portions that clip through clothing.
    • Deleting parts for aesthetic reasons (e.g., shortening a ribbon).
    • Reducing polygon counts by deleting unnecessary parts.

    Note on Efficiency:

    • If Mesh Cutter is always active, Modular Avatar deletes the selected polygons entirely, which helps reduce polygon count.
    • If Mesh Cutter is sometimes inactive, Modular Avatar hides the selected polygons instead. This may require generating constraints, which can impact performance rank.

    When NOT to use it: If you want to turn off a mesh that is completely covered by another mesh, use Object Toggle instead. Mesh Cutter still processes the entire mesh even when parts are hidden, making Object Toggle more efficient for full-mesh toggling.