Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader Toggle Malfunction: Loss of Animation in Combined Skinned Meshes Utilizing Liltoon Fur Shader #66

Closed
jerryzmtz opened this issue Dec 11, 2023 · 6 comments

Comments

@jerryzmtz
Copy link

jerryzmtz commented Dec 11, 2023

Description:
I've discovered a compatibility issue involving the d4rkAvatarOptimizer plugin in Unity 2019, particularly when used alongside VRChat SDK 3.4.1, that affects the Liltoon Fur Shader. The expectation is for the shader's material properties to be animated correctly after the optimization process.

Issue Details:
Affected Shader: Liltoon Fur Shader
Settings: "Use shader toggles" is on.
Expected Behavior: Post-optimization, the material properties of the shader are anticipated to animate correctly, maintaining their intended functionality and appearance.
Observed Behavior: After optimization, there is a notable issue with the animation of material properties for combined skinned meshes using the Liltoon Fur Shader. Specifically, these material properties fail to animate as expected.

Steps to Reproduce:

Pre-Optimization Setup:
Enable the "Monochrome" toggle from expression menu. This changes the "Monochrome Lighting" material property from 0 to 0.5, as shown in the Screenshot1.
Note: This setup works correctly if "Use Shader Toggles" is unchecked, with other settings remaining the same, as shown in the Screenshot1

Post-Optimization Issues:
With "Use Shader Toggles" enabled and settings as shown in the Screenshot1, the optimized copy exhibits issues as shown in the Screenshot2.
Material properties of Liltoon Fur Shader on combined skinned meshes (e.g., "pajamas(combined)" and "socks(combined)") are incorrectly changed.
"pajamas(combined)" is a combination of four skinned meshes, as depicted in the provided screenshot3.
Skinned meshes that are not combined (e.g., the drawer) animate correctly.

Screenshot_5
Screenshot_6
Screenshot_7

@d4rkc0d3r
Copy link
Owner

hmm I remember adding a check specifically because of liltoon fur that checks if the shader name contains lilToon to make sure the optimizer doesn't try anything funny on it.
Can you check in the debug info that it correctly lists the fur shader as not supported?
(Unsupported shaders are supposed to be treated as if "Use Shader Toggles" is turned off)

@jerryzmtz
Copy link
Author

hmm I remember adding a check specifically because of liltoon fur that checks if the shader name contains lilToon to make sure the optimizer doesn't try anything funny on it. Can you check in the debug info that it correctly lists the fur shader as not supported? (Unsupported shaders are supposed to be treated as if "Use Shader Toggles" is turned off)

It is correctly listed in unparsable materials.

Screenshot_5
Screenshot_6

@d4rkc0d3r
Copy link
Owner

one last question. do the material property animations rely on write defaults?
because the default value of a material property animation is whatever the first material of a mesh renderer has the property set as which can be really confusing.
thanks for all the info so far.

@jerryzmtz
Copy link
Author

jerryzmtz commented Dec 11, 2023

one last question. do the material property animations rely on write defaults? because the default value of a material property animation is whatever the first material of a mesh renderer has the property set as which can be really confusing. thanks for all the info so far.

I have checked with a blank avatar with only one toggle: Monochrome. In this example, all the poiyomi shader meshes are combined as "Body", while all the liltoon fur shader meshes are combined as "Pajamas$String". I have located the only animation and notice that although liltoon fur shader is left untouched, material properties of liltoon fur shader is renamed to shader toggles.

As for write defaults, I always unify it to WD ON. But I am not sure what do you mean by "rely on". Basically all the materials behave the same with regard to "Monochrome". The default state is something like "Monochromatic lighting=0" while the toggled state being "Monochromatic=0.5". Every material has exactly the same settings, so "the first material of a mesh renderer "does not matter in my case.

Screenshot_7
Screenshot_8

@jerryzmtz
Copy link
Author

jerryzmtz commented Dec 11, 2023

This is an example without "use shader toggle". In this case, "Pajamas$String11" still exist so it works as expected.
Screenshot_9

@d4rkc0d3r
Copy link
Owner

As for write defaults, I always unify it to WD ON. But I am not sure what do you mean by "rely on".

With that I meant if you have animations for both states or just 1 animation state. WD ON can still do 2 animations like WD OFF and then it wouldn't matter if the states have WD ON or OFF actually set.

But as you described this shouldn't matter in your case.

Thanks to your detailed info I now know what causes the issue, thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants