Author Topic: Best way to have a second additive material (UIAtlas)  (Read 4026 times)

kajed

  • Guest
Best way to have a second additive material (UIAtlas)
« on: August 06, 2013, 02:51:50 PM »
I was wondering what the best way to create a second material that can easily be assigned to any given UISprite that will use an additive shader for the material.

I just want to be able to draw an additive version on top of a regular sprite. I also don't want to have to ever update the second material (just uses the original sheet anyways).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to have a second additive material (UIAtlas)
« Reply #1 on: August 07, 2013, 05:16:43 AM »
Just create a copy of an existing one and change its shader.

kajed

  • Guest
Re: Best way to have a second additive material (UIAtlas)
« Reply #2 on: August 07, 2013, 05:50:33 AM »
That doesn't really work.  You can clone the material and make it additive but a UISprite has no way to just assign a material, you have to assign a UIAtlas WITH a material. If you clone the atlas itself and point to the same material then you now have to make sure BOTH atlasses stay correctly up to date (ie: duplicate and modify the original every time you add / remove from the sheet).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to have a second additive material (UIAtlas)
« Reply #3 on: August 07, 2013, 05:52:48 AM »
Yes, you have to replace the material on the atlas. Are you trying to affect only 1 sprite on the screen? If that's the case, then you have to use a UITexture here instead of a sprite. That lets you choose a material.

kajed

  • Guest
Re: Best way to have a second additive material (UIAtlas)
« Reply #4 on: August 07, 2013, 05:54:43 AM »
The sprite I want to use is already on a sheet, and SHOULD stay on that sheet.

It would be nice to see a feature allowing us to override the shader on any given UISprite.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to have a second additive material (UIAtlas)
« Reply #5 on: August 07, 2013, 05:56:52 AM »
The upcoming UI system will let you do that. I doubt I'll be changing NGUI to allow this, however.

kajed

  • Guest
Re: Best way to have a second additive material (UIAtlas)
« Reply #6 on: August 07, 2013, 06:02:01 AM »
Well that's just downright mean! I guess I'll just have to make due with updating the second atlas.

There's a new UI Asset in the works?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to have a second additive material (UIAtlas)
« Reply #7 on: August 07, 2013, 06:02:39 AM »
Built-in solution for Unity. I work at Unity Technologies.

kajed

  • Guest
Re: Best way to have a second additive material (UIAtlas)
« Reply #8 on: August 07, 2013, 06:04:07 AM »
I'm not sure if I should be excited for a built in UI system or sad that something might replace NGUI.  Especially given it's unlikely we'll change mid project.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to have a second additive material (UIAtlas)
« Reply #9 on: August 07, 2013, 06:04:55 AM »
There is still a while to go until it's ready.

galuodo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: Best way to have a second additive material (UIAtlas)
« Reply #10 on: August 07, 2013, 11:34:14 AM »
Our project also encountered this problem, I use the UITexture instead.