- Home /
Using two colors on the same texture?
Hello.
The shirt of the model needs to be customizable. I mean there are different shirt designs, and you can change their design (like with stripes, clean, etc) and colors (color 1 for the stripes and color 2 for the rest). I don't know how to apply different colors to a texture, specifing which color (or channel) in the image will be replaced.
This image shows what I mean:
I tried few custom shaders, but none of them fit my needs.I'm learning, but I have no idea on how I could do a shader for this.
Is there any other solution beside using a custom shader?
Answer by Berenger · Jun 23, 2012 at 05:59 PM
You can use a mask (grayscale texture) anda lerp inside the shader. 0 is color1, 1 is color 2.
I made a texture with alpha channel and a normal diffuse texture. I've put a shader that blends these two images. Now I can change the color of the alpha texture, but I can't change the color of the diffuse texture.
This is the shader script: http://pastebin.com/haZLJEnq
This is the result: http://i47.tinypic.com/24ccz05.jpg
This is late but the code posted above was very helpful. I have been searching for a way to do what it does for hours.
As for the problem, simply change line #41 to "o.Albedo = c.rgb * (d.rgb*2);".
I've updated a pastebin with that code: http://pastebin.com/XYBd9ZRz
Answer by Vanblam · Aug 04, 2014 at 11:05 PM
lol I want to use this cause I'm stuck in the same situation. But I'm getting an syntax error at line 7. I'm very new to shaders so I have no clue why that error is showing up.
Answer by GamesDeveloper12 · Jul 27, 2015 at 07:07 PM
hi, could you please share the completed textures, so i can see how to make mine as i am struggling to get this to work.