Jessy: thanks for reporting the bug, and thanks for the heads-up on the Color statement! Using vertex alpha for blending is not an option unfortunately, because the mesh is quite low poly; all the detail is in the textures.
I also think this is just an undocumented limitation of the older iPhones, so I ended up going “well, if I’m doing three passes, I may as well blend four layers instead of three and get more bang.”
So this is the final (complete) shader, which blends four solid colors using three alpha-maps, and then applies a grayscale diffuse map and shading:
Shader "LayerShader"
{
Properties
{
_DiffuseMap ("DiffuseMap", 2D) = "white" {}
_Layer1 ("Layer 1", 2D) = "white" {}
_Layer2 ("Layer 2", 2D) = "white" {}
_Layer3 ("Layer 3", 2D) = "white" {}
_Color0 ("Color 0", Color) = (1,0,0,1)
_Color1 ("Color 1", Color) = (0,1,0,1)
_Color2 ("Color 2", Color) = (0,0,1,1)
_Color3 ("Color 3", Color) = (1,1,0,1)
}
SubShader
{
Material {
}
ZWrite On
Pass {
Color [_Color0]
ZTest Less
Lighting Off
Blend Off
SetTexture[_Layer1] { combine primary }
SetTexture[_Layer1] { constantColor [_Color1] combine constant lerp (texture) previous double }
}
Pass {
Color [_Color2]
ZTest Equal
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
SetTexture[_Layer2] { combine primary, texture alpha }
SetTexture[_Layer3] { constantColor [_Color3] combine constant lerp (texture) previous double }
}
Pass {
Material { Diffuse (1.6, 1.6, 1.6, 1) Ambient (1, 1, 1, 1) Emission (0, 0, 0, 0) }
ZTest Equal
Lighting On
Blend DstColor SrcColor
SetTexture[_DiffuseMap] { combine primary * texture alpha }
}
}
FallBack "Diffuse", 1
}