- Home /
Shader with multiple alpha textures, single color for each texture, how to?
I'm trying to make a shader which contains 3 textures, where each texture has its own color.
I've done research and written some code but I haven't found a solution yet, so I'm looking for help.
This is what I'm trying to achieve:
As you can see, there are 3 textures on top of each other and 3 colors. The color C1 has be assigned to the texture T1 and so on. These textures have an alpha channel and the alpha channel has to be preserved. Each color must not affect the color of other textures.
This is the base code:
Shader "MultipleTexturesMultipleColors" {
Properties {
_C1 ("C1", Color) = (1,1,1,1)
_C2 ("C2", Color) = (1,1,1,1)
_C2 ("C3", Color) = (1,1,1,1)
_T1 ("T1", 2D) = "" {}
_T2 ("T2", 2D) = "" {}
_T3 ("T3", 2D) = "" {}
}
SubShader {
Pass {
Material {
Diffuse [_C1]
}
AlphaTest Greater 0.5
SetTexture [_T1] { combine texture }
SetTexture [_T2] { combine texture lerp (texture) previous }
SetTexture [_T3] { combine texture lerp (texture) previous }
}
}
}
Answer by ramonfr · Aug 14, 2015 at 01:54 PM
Answer is here: http://forum.unity3d.com/threads/blending-two-colors-with-texture-and-weighting.285974/#post-1888639
Your answer
Follow this Question
Related Questions
Material alpha is 1 but still see through 0 Answers
Changing material color´s alpha in self iluminated shader 1 Answer
UGUI button gray shader 1 Answer
How to apply different textures to one model? 1 Answer
Boat wake/foam 0 Answers