Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: S3XY on October 04, 2016, 07:42:06 AM

Title: Depth and distance to camera
Post by: S3XY on October 04, 2016, 07:42:06 AM
hi there,

i have a 3d map with a lot of Ngui-Labels and Ngui-Icons in 3d space. All labels have a depth of 1 and the icons  a depth of 0. Every element is looking towards a moving perspective camera. Now i'm trying to set the the render order by distance to camera while the labels should be rendered always over the icons. Are there ngui/panel/widgets settings to archive this or do i have to write script that adjusts the depth during runtime?

Cheers
Title: Re: Depth and distance to camera
Post by: ArenMook on October 06, 2016, 06:00:29 AM
I would suggest setting the depth values at run time. It would involve fewer draw calls.
Title: Re: Depth and distance to camera
Post by: S3XY on October 06, 2016, 08:03:11 AM
Hi ArenMook,
thx a lot for your reply. I already made a script but with over 200 objects to control, things get very laggy. Even with only updating every 10th frame when the camera moves a certain distance. Maybe i should switch to Unity build-in 3d texts? But because nGui is heavily implemented in the project i will try to optimize the depth update first.

Cheers
Title: Re: Depth and distance to camera
Post by: ArenMook on October 11, 2016, 09:30:51 AM
Changing depths of widgets would be expensive, but changing depths of panels is cheap. If you are doing a HUD where you have something like player names above players' heads, you can put each label+icon combo on a separate panel, and change the depth of those panels instead of widgets.