Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: kittikun on February 09, 2014, 10:47:17 PM
-
Hi all,
I was wondering if it was possible for NGUI to write to the depth buffer.
The idea would be to save some fill-rate by rendering the non-transparent UI first so and fill the depth buffer so that no rendering is occurring below.
I would like to know the following points:
- If I have one UIPanel, only one quad is generated ?
- If it is the case, having multiple drawcall would mean that the whole screen quad is drawn multiple times ?That would seem totally inefficient..
I suppose my question is more about how the NGUI rendering pipeline works.
To achieve the effect I want, the current approach would dictate using multples panels and write a custom shader to write to the depth buffer where the alpha is == 1.
For widgets requiring alpha, they would be drawn as usual after the scene has been rendered.
Any insights on this ?
Thank you
-
There is very little reason to use depth writes in UI. NGUI 2 used to have this feature, but after some performance testing on mobile devices I canned it. It wasn't gaining any. Quite the opposite (as I was drawing things twice).
The only feasible performance gain you can possibly obtain from this is if your UI and game world share the same depth buffer -- which is rarely ever the case as the UI is generally drawn using a separate camera. In this approach you'd draw the UI to depth first, which would Z-fail the game geometry.
Long story short -- it's not worth it.