Another VRChat shader revelation

I don’t actually need the pigment map to look good in untrusted mode: I can have the material itself provide a fallback texture! There’s nothing stopping me from putting a _MainTex slot on the shader which just does nothing on the shader, but which would be used by the Standard fallback; I can use other texture slots for the pigment map and palette. So obvious.

Also, when laying out the palette, it would be helpful to group related things next to each other, which makes mipmapping play more nicely (and also makes authoring eaiser, although still not as easy as just fiddling with sliders in the Unity editor, unfortunately).

In any case, I’ll probably target 16 attribute bands, which gives me plenty to work with; here’s the ones I can think of right now (and a rough ordering for texture authoring purposes), and this is with coming up with way more hyper-fiddliness than I actually need:

  • Eyelids
  • Base skin
  • Tummypatch skin
  • Hair (normal)
  • Hair (streak)
  • Nose
  • Lips
  • Inside of mouth
  • Tongue
  • Teeth
  • Horns
  • Eye albumen-iris-pupil
  • Collar fabric
  • Collar tag (modulation controls back-edge-front-engraving)

Okay, that’s nearly 16 bands already, so maybe I’ll reserve 32 bands. Really it should be safe to go up to 64, although then you’d probably start to run into banding artifacts on inter-band transitions and color bleed issues when mipmapping.

Also, the bottom rows of the colormap should be reserved for various modulation effect gradients, for example subsurface and ambient occlusion.

This makes me realize that it’d also be fun to maybe experiment with lighting ramps in the future. I wouldn’t want to bake that into the color map though, it’d have to be done as a separate function (and texture lookup) in the shader. I think the Unity standard shader has a mechanism for overriding lighting computations, in which case that would be fairly easy to add! It would be fun to do things like adding toon/cel shading, or inverting the lighting ramp to give it an otherworldly effect, among other things. But that can come later.

Update: It is indeed possible to override the lighting calculations, and one of the examples even shows how to use a lighting ramp texture for it. Convenient.

Comments

Before commenting, please read the comment policy.

Avatars provided via Libravatar