Author Topic: New "Depth" system  (Read 2644 times)

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
New "Depth" system
« on: February 18, 2014, 12:27:53 AM »
Dont understand how it works new system of drawcalls in 3.4.8 ver with "depth". How can i decrease drawcalls with depth , bcoz after update from 2.7 ver , my same panel increases drawcalls in NGUI 3.4.8 , Who could explain to me? How make 1 drawcall with many uiwidgets ?
thanks a lot.
« Last Edit: February 18, 2014, 12:57:57 AM by PoN »
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New "Depth" system
« Reply #1 on: February 18, 2014, 10:10:06 AM »
First, please update to the latest version. 3.4.8 is out of date.

Everything in NGUI 3 is based on depth. First panel depth, then widget depth. It's easiest to think of panels as directories in your operating system, and each widget being like a file in your operating system.

Files (widgets) are always located in some directory (panel), and if you have similarly named (same depth) files in different directories, they won't interfear with each other.

When sorting things, all widgets are sorted by panel depth first, then by widget depth. If you have more than one material being used under a panel, NGUI will split up draw calls in order to maintain the proper draw order. So if you have something like this:

Sprite (depth 1)
Dynamic label (depth 2)
Sprite (depth 3)

...that means that in order to draw this properly NGUI has to create 3 draw calls instead of just 2. You can reduce it back to 2 like so:

Sprite (depth 1)
Dynamic label (depth 3)
Sprite (depth 2)

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: New "Depth" system
« Reply #2 on: February 24, 2014, 02:58:00 AM »
Quote
Sprite (depth 1)
Dynamic label (depth 2)
Sprite (depth 3)

...that means that in order to draw this properly NGUI has to create 3 draw calls instead of just 2. You can reduce it back to 2 like so:

Sprite (depth 1)
Dynamic label (depth 3)
Sprite (depth 2)

So what's difference here ? place of widgets in GameObject ?
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: New "Depth" system
« Reply #3 on: February 24, 2014, 07:56:08 AM »
The depth is changed. A UIPanel collapses all widgets with the same material and no other materials sandwiched in between them via the depth setting.

depth 1 material A
depth 2 material B
depth 3 material A

Gives you 3 draw calls, 1 A, 1 B, 1 A.

but switching the depths on the different widgets like so:
depth 1 material A
depth 3 material B
depth 2 material A

means that the two widgets with material A can be collapsed into on drawcall and the final total is now 2 draw calls: 1A (with 2 widgets in it), 1 B.


Does that clarify it?

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: New "Depth" system
« Reply #4 on: February 24, 2014, 09:29:07 PM »
Yeap. But i see function in menu NGUI-> "Normalize Depth Hierarchy" nothing to do. i selected my widgets in gameobject , then set depth to 0 each widget , then try to normalize, and after i see depth ,same same before.

Could check pls ? thanks a lot peeps.
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New "Depth" system
« Reply #5 on: February 25, 2014, 12:35:26 PM »
Normalizing depth will bring the depth in order. So if you have widgets with depth of -1, 2, 10, they will become 0, 1, 2 after normalization.

NGUI will never change the depth order for you, so if you have widgets on the same depth before normalization, they will still have the same depth after.