Author Topic: UISprites On 3D Objects  (Read 8707 times)

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
UISprites On 3D Objects
« on: October 03, 2012, 05:26:27 PM »
I'm know that NGUI wasn't designed for it. However, what I'm trying to accomplish is as follows. I'm trying to see if I can put transparent UISprites on 3D objects in the scene. Kind of like symbols on a die. Then have the rendering be correctly determined by their z-depth. Do you have any recommendations?

Right now I'm using Sprite Manager 2 to get the sprites in the scene which works great... because each sprite relies on dynamic batching, but now I need to go those symbols in the UI as well. I'd rather not double-dip on having an atlas for the faces and having those same symbols in the UI texture atlas.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprites On 3D Objects
« Reply #1 on: October 03, 2012, 08:08:50 PM »
NGUI can handle it just fine. All NGUI widgets are just scripts on game objects somewhere in the world. For your case, you will likely want this kind of a setup:

3D GameObject
- UIPanel and FaceCamera script
--- Scaled Object (something to adjust the scale of your UI element)
----- Widget
----- Widget
----- Widget

Rizzen1998

  • Guest
Re: UISprites On 3D Objects
« Reply #2 on: November 07, 2012, 11:28:51 PM »
I'm fighting this exact issue right now.  What do you mean a scaled object?  I'm fighting scaling issues when attaching to my 3d objects so I'm dying to have some advice on this subject.  Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprites On 3D Objects
« Reply #3 on: November 08, 2012, 04:43:32 AM »
By default if you add a UI sprite to an object, it will be in pixels -- so if the sprite is 100x40, it will be 100 by 40 units. If there is no scale, this will result in a huge sprite on top of your regularly sized 3D model.

Rizzen1998

  • Guest
Re: UISprites On 3D Objects
« Reply #4 on: November 08, 2012, 08:09:35 AM »
So what kind of scaled object do you use and how do you do it?  I'm just having a hard time grasping it.  Thanks for your time.

Rizzen1998

  • Guest
Re: UISprites On 3D Objects
« Reply #5 on: November 08, 2012, 08:30:46 AM »
I guess what I'm asking is what UI object should I use for scaling... What is the best object to use?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprites On 3D Objects
« Reply #6 on: November 08, 2012, 02:01:32 PM »
Eh? o_O

In your case, there is no "UI" per say. You are adding UI elements to existing 3D hierarchy. Your UI elements aren't going to be parented to a UICamera or a UIRoot. In fact, you won't have either of them.