Hello Guest

Author Topic: Draw calls on groups  (Read 4273 times)

ArdeII

  • Newbie
  • *
  • Posts: 4
    • View Profile
Draw calls on groups
« on: November 22, 2013, 05:55:54 pm »
 Hi,
I noticed that if I have one sprite outside a group and one sprite inside a group and it has transform x=10 then it adds one additional draw call.
Both sprites have exactly the same properties except the grouped one has transform x=10. Material for both is t2kd/Blend2TexVertexColor.

When I change the sprite material for both to tk2d/AdditiveVertexColor draw call count is 2 even if the grouped sprite has transform x=0.

Very weird. Me being noob I really don't understand what's going on here.
Have you an idea why this happens?
« Last Edit: November 22, 2013, 05:57:41 pm by ArdeII »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Draw calls on groups
« Reply #1 on: November 22, 2013, 10:46:34 pm »
What is a group?
And are they both from the same sprite collection / material? The shader is irrelevant here, if the textures differ.

ArdeII

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Draw calls on groups
« Reply #2 on: November 22, 2013, 11:49:40 pm »
A Group is just a  Game Object with transform attached to it which has sprites as children.
This way a can transform/rotate group of sprites properly.
All sprites are from the same sprite collection and share the same material.

-Arto

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Draw calls on groups
« Reply #3 on: November 23, 2013, 12:03:11 am »
Are you using localScale anywhere?

ArdeII

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Draw calls on groups
« Reply #4 on: November 23, 2013, 11:18:00 am »
No I'm not using any scales. I'm aware that when using transform scale in a sprite it adds one additional draw call.

The weirdest thing is that of course I can't reproduce the issue anymore for some reason :)

What I have noticed that the draw call count lives it's own life and adds one on places I can't figure out what's going on.
This issue isn't reproducible.
One additional draw call isn't very big deal but it will be when it starts to add up.

Is there a way to get info about the draw calls? It would be nice to know exactly what causes each draw call.

-Arto

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Draw calls on groups
« Reply #5 on: November 23, 2013, 07:23:54 pm »
Its the draw call counter in Unity that lives its own life. Does pretty random things when it feels like it. Its almost useless half the time.

The draw call rules are pretty straightforward, group stuff from the same atlas in z, avoid localScale if possible. The counter does pretty random things and has been broken many times in various ways in many versions of Unity...