jayeonsu

I'm trying to attach items to the character. (my Unity3D version is 5.2.21f)

I've been testing the basic example scene "Attributes and AtlasRegions".
As you can see the screen shot, when I hit play button, an unwelcome material takes up in Mesh Renderer per an item, which causes the SetPass calls to increase up to 5 here. but I think only 2 materials(for character and for attachments) are enough.

How can I reduce the SetPass calls? :'(


1.jpg
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
jayeonsu
  • Postovi: 7

Pharan

Lots of materials in inspector

The material list in the MeshRenderer represents the number of times the renderer needs to tell the graphics API to switch textures/shaders/materials because of the way they are layered. (Hence the 5 SetPass calls).
It has 2 materials but it needs to switch between them 5 times, in this case, because it needs to draw head parts, then the shield, then body parts, then the sword, then more body parts.

This is the way it will work anywhere, with any engine. Not just Unity. Not just Spine.

There are many ways to optimize this so you get fewer draw calls, but it really depends on what you need. 200 vs 500 calls may be worth a optimizing. 2 vs 5 is a waste of time (ie, don't worry about it. that will not slow down your game in the slightest, even on mobile.).

But there are ways like generating a big texture at runtime so even if you need a mix of textures, you can have the characters just use one texture so it never needs to switch materials. Again, this is only worth doing if you need it.
Avatar
Pharan
  • Postovi: 5366

jayeonsu

Okay. Understood. Thanks for answering. :)

In my game, there are many players who wear different gears and can change wearing-gears.

So I think a texture for each player should be generated and it should be regenerated when changing wearing-gears at runtime.

But I don't know the way how I can interlink "a big generated texture" and "spine skeleton character" at runtime.

Could you suggest a way/direction to accomplish packing textures and apply it to the spine character at runtime?
jayeonsu
  • Postovi: 7


Natrag na Unity