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

Material merging results in corrupted material/textures #5

Closed
rskskr opened this issue Aug 19, 2022 · 5 comments
Closed

Material merging results in corrupted material/textures #5

rskskr opened this issue Aug 19, 2022 · 5 comments

Comments

@rskskr
Copy link

rskskr commented Aug 19, 2022

Using Silent's Crosstone, I've been trying to merge 4 materials together, but the results are a bit... complicated.

There's something like a 50-50 chance that the merged materials result as either

Unity_vhzFT5Lbz9

or

Unity_dUrDqaVgFh

The latter looks almost right, but with strange shadow stepping along the hair.

Both produce an identical error message:

Unity_3Enc5MqoGa

I've attached the resulting shader/material for result 1 and 2.
result 1.zip
result 2.zip

@d4rkc0d3r
Copy link
Owner

The first result looks like you used crunch compression on your textures. Texture arrays don't support crunch compression, I will add a warning for that.

@rskskr
Copy link
Author

rskskr commented Aug 19, 2022

Oops, you're right, I was using crunch compression. With it disabled, I can consistently get the 2nd result now. Same error.

@d4rkc0d3r
Copy link
Owner

I added a warning for crunch compressed textures as well as stop it from trying to merge them.
I also inline replace the UNITY_POSITION macro since it seems to always resolve to the same thing anyways. You can download the newest code to get the fix.

@rskskr
Copy link
Author

rskskr commented Aug 19, 2022

Thank you, again! That solved the issue, but I inadvertently found something else I think. I noticed that if I merge materials where one of them has a normal map and the others do not, I can run into broken normals after optimising. Is this by design, and should I instead include a flat (128, 128, 255 rgb) normal map for the rest? Below is a before/after optimising.

Unity_LEnsF4ze1r
Unity_fUrMVd7Vc3

@d4rkc0d3r
Copy link
Owner

Looks like the unity docs page lied about the default bump texture value. I figured it out and fixed it, thanks for the report.

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