Is there a quick way to tint just part of a material? I’m using tinting to allow parts of a model’s colors to be changed on the fly… but right now I am doing that by providing them with their own, disjoint mesh, and changing the tint color on the material attached to it… this doubles my draw calls (I have lots of these models in a given scene), which are far and above the biggest drain on FPS right now (the triangle counts are pretty low).
The catch is that I need to be able to change the material tint on the fly, so I’m looking/hoping for an approach which is not, in and of itself, a (C/G)PU hog.
This would be the least expensive way (especially so in Unity iPhone, where batching is possible). I didn’t bother to account for lighting, though. You need it?
It’s also possible to mask off areas with vertex alpha if you need hard edges, your level of tessellation is great enough, and you don’t want to bother with an alpha mask in a texture, which makes the RGB colors look worse.
So everything renders at full bright regardless of lighting? That actually works out fine for me- the only light I use is the ambient light, which I only use because I can’t figure out how to turn it off.
It looks like the Masked Tint shader is exactly what I am looking for… I’ll check back in once I test it.
Actually- do either of you know how to modify the Mask Tint shader to respond to the ambient light settings? I think I want to multiply the colors by the ambient light values, but shader programming has never made any sense to me…
Hello, I think I have similar problem.
I have a Mask texture with every rgba channel a color.
(example: yellow in R, orange in G and some other color in each texture channel)
And I have a base texture (grey scale)
And I want to blend both (final color = baseTextColor* MaskR color + MasG color + …
Which modification should I made over you shader to acomplish this?
That would be so much of a “modification” that you wouldn’t call it the same shader anymore. There’s no way to do that with ShaderLab alone, so I can’t help you at this time.