Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: bac9 on June 10, 2014, 09:21:41 AM

Title: Color tint support for custom shaders
Post by: bac9 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?
Title: Re: Color tint support for custom shaders
Post by: Simie on June 10, 2014, 10:40:18 AM
I believe it uses vertex colours for tinting sprites in the default shaders.
Title: Re: Color tint support for custom shaders
Post by: ArenMook 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.