Author Topic: NGUI Atlas to 2d Planes with main camera  (Read 2692 times)

zipper

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
NGUI Atlas to 2d Planes with main camera
« on: September 02, 2012, 06:20:59 PM »
Hi,

First, thank you for one of the best Unity plugins!

I need to create a game with thousands of static 2d stylized trees, houses, animals, etc, which are positioned within a 3d landscape.

I can create atlases with NGUI, but how do i apply the sub-atlas images to regular planes in Unity which are rendered by the main camera?

I just want the 2d sprites rendered through the regular render pipeline, and sorted by regular z-depth.

Thank you for any help,
zipper

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Atlas to 2d Planes with main camera
« Reply #1 on: September 02, 2012, 07:22:55 PM »
Regular sprites can be visible my your main camera if you want. All the geometry NGUI creates is just that -- geometry. It's up to you to specify which camera is able to see it.

zipper

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: NGUI Atlas to 2d Planes with main camera
« Reply #2 on: September 04, 2012, 11:14:26 PM »
That's true, however, the sprites must be placed under a panel, and the whole thing can be accidentally re-scaled by selecting the automatic button on the panel. Also, it doesn't seem to work very well with depth of field, but that could just be me.

I guess i was hoping for something like a UITexture (UIAtlasTexture) that allows one to pick a texture from an atlas, and starting dimensions for the 2d sprite (so the resultant sprites would not have to be scaled to get different sizes).

I don't mind doing the work, if you could point me in the right direction. I would be happy to post it once finished, if others find it useful.

Best,
zipper


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Atlas to 2d Planes with main camera
« Reply #3 on: September 05, 2012, 03:10:59 PM »
The default shader used by the UI doesn't write to depth, so you'd need to either enable the "depth" option on the panel, or use a shader that writes to depth by default if you want it to work with depth of field.

I'm not sure what "automatic" button you're referring to. There is nothing like that on the panel. Do you mean a UIRoot? You don't have to use it, it's optional.