Greetings!
I need to change a color of a part of texture (diffuse), wich will not hit on my performance couse this is going on mobiles.
For example i have a house with red roof and i wanna change it to blue roof.
How i can do this? with color mask or maybe switch materials on runtime? any ideas?
Try adding a ColorTint variable and then using Shader.SetGlobalColor(āColorTintā) in a script to Red (1,0,0,1) and then multiply your _MainTex (Diffuse Texture) by that value.
If itās a specific part of the texture, you could just create another texture with the different colour and swap them out at run time.
yeah tnx, i will try this alpha channel mask.
Not strong in shaders⦠maybe somebody have this shader with alpha channel mask for color change? maybe with scroll wheel for change colors?
Thank you for your attention
This is honestly as far as i know the most-requested type of shader (and as such has been provided in tons of similar posts and unity-wikiās) please use the search youāll have what you need in a jiffy (or not because of former likeminded people >.> )
(These two threads i quickly looked up should get you started too; http://forum.unity3d.com/threads/28130-Texture-tinting-performance and http://forum.unity3d.com/threads/28932-Alpha-used-to-modify-the-multiply )
Do you need to display houses with different coloured roofs at the same time? If not, then creating textures at runtime might be faster than accessing multiple textures every frame.
That said, the bandwidth used by uncompressed textures (required for runtime editing) might cost more than the two accesses.
Yeah i need many colored roofs at the same time.
Tryed this colored mask shader, perhaps i will need more than 1 material for them all, and than this shader doenst needed, better make nicely colors what i need in diffuses and change thems, cause i have dozens of same objects with 4-5 different colors, so it is anyway minimum 5 materials⦠i think atlas on run time for them will save meā¦)
tnx you guys for answers:sunglasses: