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

Read more…

Come to think of it…

It would probably make a lot more sense to just do all of the color schemes as indirect lookups on a “swatch” texture. The math is a lot simpler, it would allow other things like baking gradients in easily, and would also give a lot more flexibility when it comes to various interactions; for example, I’d be able to encode arbitrarily many skin colors into things, which would allow for argyle and such as well. Plus it would give me even more color slots to work with, so I could also have separate colors for the lips, tongue, nose, and inside of the mouth (which are currently stuck using the same color).

Also, doing that would only require two of the channels in the pigment map, which would free up the other two channels for the occlusion and subsurface maps, which would make everything way more efficient overall.

Yeah, I like this idea.

Custom VRChat shader, good and bad

So, today I had a great idea for making a custom shader for my VRChat avatar which would make it much easier for me to generate color schemes for my avatar. I called the technique a “Pigment Map,” for lack of a better term; basically I used the four channels of a texture as fuzzy “bits” in a palette lookup, and set things up cleverly so that I could modulate between a bunch of different colors based on surface pigmentation and indirect lookup thereof. The idea is that I wouldn’t need to bake out a bunch of textures for, say, red-and-black plaid, purple plaid, green plaid, etc., and could just have mappings for high-level colorations like plaid, stripes, splotches, and so on. Y'know, as one does.

Read more…