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

RGBA Color masking not works after optimization #76

Open
jerryzmtz opened this issue Feb 1, 2024 · 12 comments
Open

RGBA Color masking not works after optimization #76

jerryzmtz opened this issue Feb 1, 2024 · 12 comments

Comments

@jerryzmtz
Copy link

jerryzmtz commented Feb 1, 2024

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
Copy link
Author

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

@jerryzmtz jerryzmtz reopened this Feb 1, 2024
@d4rkc0d3r
Copy link
Owner

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:

  • screenshot of your optimizer settings
  • screenshot of the mesh & material merge preview
  • zip of all the generated .shader & .cginc files

@jerryzmtz
Copy link
Author

@d4rkc0d3r
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Author

jerryzmtz commented Feb 10, 2024

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
Copy link

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.

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

3 participants