Closed ACIIL closed 6 years ago
For some reason the render queue always stays to what is set in shader, in this case it's geometry. Fixable if you do this:
Tags { "Queue" = "Transparent" }
Weird is that the Unity's Standard shader does not have this issue.
Queue geometry is used for opaque objects.
Easiest way to test this is to set queue to transparent in material, then in game see that skybox renders over it. That is because skybox renders after all opaque and because your material rendered in opaque and didn't write into z buffer.
I guess a work around would be to have more shaders and switch between them based on selected mode: 1) Opaque -> Flat Lit Toon Opaque -> Tags { "Queue" = "Geometry" } 2) Cutout -> Flat Lit Toon AlphaTest -> Tags { "Queue" = "AlphaTest" } 3) Fade, Transparent -> Flat Lit Toon Transparent -> Tags { "Queue" = "Transparent" }
@netri The standard shader does not handle setting the queue in the shader with variants. Nor would creating separate versions be a good idea. It uses the Standard Shader's ShaderGUI to set queue when it detects material changes. This is handled in a method called SetupMaterialWithBlendMode.
Although I think this is a Unity3D/VRChat bug. Queue doesn't seem to work properly when set sometimes on materials. I honestly don't know, Cubed is doing the same thing as the standard shader in the GUI.
@HelloKitty yes that is what's odd, it works with Standard but seems to not work with Flat Lit Toon.
This might be related: https://gamedev.stackexchange.com/a/129056 When testing this I always made sure the queue was correct in inspector debug mode. The only solution I found so far is to use another shader.
I've split up the Flat Lit Toon Lite shaders into separate Opaque, Cutout, and Transparent versions to avoid this issue; if you don't care about outlines then you can use the lite version.
TCL's changes fix this issue, closing.
Fade mode materials renders behind opaque materials rendering. It looks correct in the unity editor but in-game it does not. I can only guess if it is related to the render order or if vrchat is somehow masking the fade layer with something of its own.
for example, the render error will affect problems like mesh designed for emotes with transparent textures, or dress like materials with patterned holes(which is funny to see when legs render cleanly over the dress).