Is it possible to blend three textures in a shader based on vertex color for iPhone?
It seems the only option to use for blending is only the alpha channel of the vertex color, or alpha channel of a texture. Is there any way to use the vertex RGB values?
1 Answer
1
OK, figured it out. Had to make it a two pass, but it'll work.
Here it is in case anyone needs it:
1.) Paint 0 alpha for texture 1
2.) Paint 1 alpha for texture 2
3.) Paint White for texture 3
///////////////////////////////////////////////////////
Shader "iPhoneVertexBlend" {
Properties {
_MainTex ("Texture 1 (white vertex A)", 2D) = ""
_Texture2 ("Texture 2 (black vertex A)", 2D) = ""
_Texture3 ("Texture 3 (black vertex A)", 2D) = ""
}
SubShader {
BindChannels {
Bind "vertex", vertex
Bind "color", color
Bind "texcoord", texcoord
}
Pass {
SetTexture [_MainTex] { Combine texture - primary}
SetTexture [_Texture2] { Combine previous Lerp(primary) texture}
}
Pass {
Blend One OneMinusSrcColor
SetTexture [_Texture3] { Combine texture * primary}
}
}
}
could I ask if you could share your eventual solution ? as Im stuck on this. Im mainly going to be using this for displaying Kinect data
– starlord89