Author Topic: Color tint support for custom shaders  (Read 1902 times)

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
Color tint support for custom shaders
« on: June 10, 2014, 09:21:41 AM »
Can someone point me to proper way of exposing shader tint color to NGUI? Every single shader shipping with NGUI has no such property, yet somehow every texture and every sprite still supports tinting. How is it achieved? I'm mostly interested in that to get UITexture elements with custom shaders working with NGUI inspector tinting, as creating materials and dragging them into UITexture material slot every time you need to update a color isn't the most convenient workflow.

I tried few widespread naming conventions like _Color and _Tint, but NGUI seems not to search for properties named like that. What is it using then?

Simie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
Re: Color tint support for custom shaders
« Reply #1 on: June 10, 2014, 10:40:18 AM »
I believe it uses vertex colours for tinting sprites in the default shaders.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Color tint support for custom shaders
« Reply #2 on: June 11, 2014, 04:22:18 AM »
It makes no sense for NGUI's shaders to use a material-set color because it would be global, and NGUI's draw calls contain many widgets.

As Simie pointed out, NGUI's widgets use vertex colors instead.