d4rkc0d3r / d4rkAvatarOptimizer

d4rkpl4y3r's VRChat Avatar 3.0 optimizer
MIT License
396 stars 17 forks source link

RGBA Color masking not works after optimization #76

Closed jerryzmtz closed 1 month ago

jerryzmtz commented 9 months ago

I have made animations to change the value of RGBA Color masking of poiyomi, as shown in the screenshot. It could be changed into blue, white or black. However, after optimization, the animation stops to work. This happens when I click on Merge Skinned Meshes. Is it a bug or RGBA color masking just not work with optimizer?

Unity 2022 SDK 3.5.0 Optimizer 3.3.4

Screenshot_6

edit: I noticed that it is not caused by optimizer

jerryzmtz commented 9 months ago

I have tested it more thoroughly, it seems that the material supposed to be animated is combined with other materials, but the animation clips are not correctly remapped. So it might be a issue on optimizer.

Screenshot_7 image Screenshot_8

d4rkc0d3r commented 9 months ago

Yeah idk why its not doing that for you. My own avatar has a material property animation getting correctly remapped when merged into my main mesh and a different material.

You could try to provide me with some more info and maybe something sticks out:

jerryzmtz commented 9 months ago

20210201_Remapping_Issues.zip

d4rkc0d3r commented 9 months ago

Thanks. From this I can tell that the shader portion indeed does generate code to handle the animated material property and the only thing that seems to be missing is that the path change doesn't get applied to the animation.

d4rkc0d3r commented 9 months ago

Ok I figured out the issue. You looked at the wrong generated animation. The one referenced in the optimized fx layer indeed does have the repath. However the animation relies on WD ON behavior and it seems like the optimizer didn't generate the needed properties with the correct default values for the first material.

For the record, material property animations with WD ON are super cursed since the default value is whatever the first material has and if the material doesn't even have the property the default value is 0.

jerryzmtz commented 9 months ago

Ok I figured out the issue. You looked at the wrong generated animation. The one referenced in the optimized fx layer indeed does have the repath. However the animation relies on WD ON behavior and it seems like the optimizer didn't generate the needed properties with the correct default values for the first material.

For the record, material property animations with WD ON are super cursed since the default value is whatever the first material has and if the material doesn't even have the property the default value is 0.

Thank you. So is there anything I could do to fix it or it could be avoided by your side in the future.

d4rkc0d3r commented 9 months ago

If you can change your animator workflow to WD OFF then it will probably work. Idk if that's viable to do for you.

Yes I will be trying to fix this on my side but no idea how long that will take me.

jerryzmtz commented 9 months ago

If you can change your animator workflow to WD OFF then it will probably work. Idk if that's viable to do for you.

Yes I will be trying to fix this on my side but no idea how long that will take me.

I need MMD compability so that might not be possible... Hope you could make it.

d4rkc0d3r commented 9 months ago

Ok, I looked more into this and now I am even more confused. It seems like my optimizer already handles WD ON material property animations fine? All my attempts to break it similar to your setup failed (as in they all worked the same after optimization as before). And looking at your files again they also seem to all be generated correctly, I must have missed the relevant property the last time.

So now I don't have a clue why it isn't working for you. Maybe I am missing something crucial or the issue comes from some highly complex interactions that are very specific to your avatar in particular.

jerryzmtz commented 9 months ago

Ok, I looked more into this and now I am even more confused. It seems like my optimizer already handles WD ON material property animations fine? All my attempts to break it similar to your setup failed (as in they all worked the same after optimization as before). And looking at your files again they also seem to all be generated correctly, I must have missed the relevant property the last time.

So now I don't have a clue why it isn't working for you. Maybe I am missing something crucial or the issue comes from some highly complex interactions that are very specific to your avatar in particular.

I thought it has something to do with a object with more than one material. When one object has two materials and both use poiyomi, the animated parts of shaders must both be enabled. Try the following steps to see whether you could reproduce it.

  1. A game object with two material: Mat1, Mat2
  2. Mat1, Mat2 both use poiyomi 8.1
  3. Mat1 has RGB Colormask disabled, will Mat2 has RGB color mask enabled.
  4. Create animations to change the vector of Mat2 RGB colormask
  5. Optimize
jerryzmtz commented 9 months ago

image

Enable RGB color mask: click the RGBA Color Masking session like this screenshot. Animations to change the vector: Change the R color''s color like this screenshot

Toys0125 commented 6 months ago

I also want to chime in; you can do your animations like WD off workflow with WD On since you are just explicit about the reset animation/ default animation. I do that with all my avatars to allow people to choose WD Off or On, and it won't break.

d4rkc0d3r commented 1 month ago

I changed how material property animations are handled with WD ON. As such I will close this as its no longer relevant to what the optimize is doing now. Please make new bug reports if issues arise.