More VRChat helpful things

Some more things about setting up VRChat avatars.

No texture swapping parameters

One thing I’d hoped to do is to decouple the materials from the textures, and be able to set things like normal+shininess maps separately from albedo maps. Unfortunately, texture slots are not animatable parameters, as it turns out, so the only way I can find to actually change materials is to have separate material settings for every combination you want to express. Unfortunate.

In Unity proper it’s possible to make textures into an animatable parameter, but that requires being able to add a MonoBehaviour to the object, which isn’t possible in VRChat. It might be possible to do that via Udon, but I haven’t found a way of adding Udon scripts to avatars just yet, and even if there is, there’s no guarantee that animator parameters will be exposed through those (as Udon only expresses a very limited subset of the Unity API).

Material swapping

To set up material swapping, you need to do a bunch of things.

  1. Set up an “Expression Parameters” object. Give it the default set, plus an Int parameter named MaterialChoice, which should be set to “save.”

    material-expression-parameter.png
  2. Create an animation controller for your FX, and add a layer called “Material Choice” that contains your material-setting animations.

    Each animation should have two keyframes, both of which set the avatar’s material to the material of choice.

    It’s helpful to temporarily set your avatar’s controller to the FX controller while setting these up, since then you can create the animation clips right from the Animation pane (and this should also cause them to automatically be added to the animator). However, take care to make sure that the state isn’t added to your base layer; this can cause weirdness where new states appear as defaults or as transitions between other states. (If this happens it’s safe to just delete the states from the base layer.)

  3. On the “Material Choice” FX layer, there should be a “default” state, and one state for every material you want to set, with forward/backward transitions between default and the material state.

    material-choice-controller.jpg

    Give each material state a number; I like to be systematic about it since I have so many of them but you do you. I also like to put the assigned number into the name of the state to make it easier to keep track of things.

  4. On the Default state, click on each material transition, and add a condition of “MaterialChoice Equals [num]” (where [num] is the number you assigned to the material state); on the material’s state, click on the default transition, and add a condition of “MaterialChoice NotEquals [num].”

    material-controller-transition.jpg
  5. Set up an Expressions Menu, where each of the options is a toggle that sets the MaterialChoice parameter to the assigned number for the material choice.

    material-menu-option.jpg

Also, note that there will always be at least a one-frame “blip” where your avatar’s default material appears. I like to set my avatar’s material to a transitional one for this purpose, such as Poiyomi Outline set to untextured and white with a thin black outline (as a sort of loading pause).

transitional-material.jpg

Poses

In order to add common poses (sitting, laying down, etc.) without full-body tracking, check out this unity package by Dervali which is pretty straightforward to set up, especially if you’ve already set up expressions menus for other things (like material changes).

This is less necessary if you have a full-body tracking setup, but I won’t have one of those until November at the earliest. Also it’s still nice to be able to do that even if you have an FBT setup if you have some sort of full-body chronic pain disability, y'know, theoretically.

Comments

Before commenting, please read the comment policy.

Avatars provided via Libravatar