Pharan

zeuxgame yazdı:I just had this problem few days ago
you can use Unity Texture2D.SetPixel to generate a texture yourself
to doing this, you need the atlas
and analyze its xy and size(or use original part size)
when exporting, do not let rotation option checked

I can't find a way to generate texture like spine do
so you should let your part texture to be "alpha is transparent" checked
and origin sprite sheet change the option too
in this case if you use Spine's Skeleton shader
it will be rendered weirdly
so after asign a texture to origin material
and change to Sprite/Default
on runtime copy the origin material then SetTexture using the texture you had generated
and in the object that has skeletonanimation
change the material in meshrenderer every frame by using OnObjectRendered
and this will let character only has one texture and can change part by generate a full texture that has no repeat part on it

the short is it will be a little bit expensive when generate texture
but don't really mind it, it's not affect too much
@zeuxgame
This is what you're running into: Premultiply Alpha

The Spine/Skeleton shader is a PMA shader. If you want your texture to work with the Spine/Skeleton shader, you have to premultiply the alpha with the RGB channels.
In essence, the color you need to put in SetPixel needs to be
Color pmaColor = originalColor;
float a = pmaColor.a;
pmaColor.r *= a;
pmaColor.g *= a;
pmaColor.b *= a;
texture.SetPixel(x, y, pmaColor);
If your texture was already premultiplied (eg. packed in Spine with Premultiply Alpha on), you don't need this step anymore.

If your material change is relatively permanent and applies to all instances of that skeleton (or you only ever have one instance of that skeleton), you can change the Material in the AtlasAsset instead of the MeshRenderer.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

zeuxgame

Wow
Really thanks to this solution
I will give a try tomorrow
if this work
my workflow of setpixel to generate part-collect texture will be perfect
zeuxgame
  • Mesajlar: 29

Pharan

Let me know if it works out!
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

zeuxgame

It works fine
thanks
zeuxgame
  • Mesajlar: 29


Dön Unity