Getting alpha in a separate map from color, so I can script its offset independently?

I want to have one grayscale texture file for the alpha channel and one RGB texture file for the color.

That way, I can either animate the offset of the colors while leaving the transparency fixed, or offset the transparency while leaving the colors where they are. This would be incredibly useful for all sorts of special FX. (I probably would want to make it based on self-illuminated / vertex-lit.)

Does such a shader already exist somewhere? And this is a reach, but for iPhone, too?

(I don't know what exactly makes a shader iPhoneable or not, but I understand that it's more limited in what it can do with its textures...)

The easiest way to do this is probably to use the same texture as two properties. That's one way to make it so you don't need to split RGB and A into two textures.

When you say "iPhone", I assume you're talking about the obsolete iOS devices which can't run iOS 4.3, or this shader. I haven't thought of a way to match results on that hardware, and I recommend against supporting it anyway. If you have to, then let me know what you might be willing to sacrifice on the MBXLite.

SeparateSpecular doesn't do anything on iOS, so I took it out, which will tone your highlights down. This could be written as a programmable shader to make highlights look better, but that opens up a can of lighting worms, and I'd need to know strictly what kind of and how many lights you want to support.

I haven't tested this yet; let me know if it has errors. Also, I didn't make it Beast-compatible; let me know if that is requisite.

Shader "Self-Illumin/Transparent VertexLit" {

Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _SpecColor ("Spec Color", Color) = (1,1,1,1)
    _Shininess ("Shininess", Range (0.1, 1)) = 0.7
    _MainTex ("Base", 2D) = ""
    _MainTexA ("Base", 2D) = ""
    _Illum ("Illumin (A)", 2D) = ""
}

SubShader {
    Tags {Queue=Transparent}
    ZWrite Off
    Lighting On Material {
        Diffuse[_Color]
        Specular[_SpecColor]
        Shininess[_Shininess]
    }

    Pass {
        SetTexture[_Illum] {Combine texture alpha * constant ConstantColor[_Color]}
        SetTexture[_MainTexA] {Combine previous + primary, texture}
        SetTexture[_MainTex] {Combine texture * previous Double, previous}
    }
}

}

I made this shader using Strumpy Shader Editor. I think that it does exactly what you asked, uses a different Texture for diffuse and alpha (using the alpha channel) so that you can adjust the offsets separately. I was using to make convincing clouds by adjusting the x offset of both textures at different rates. I have no idea how well it works on IOS.

    Shader "SeparateAlpha"
{
 Properties 
 {
_Diffuse("_Diffuse", 2D) = "gray" {}
_Alpha("_Alpha", 2D) = "white" {}
_Color("_Color", Color) = (1,1,1,1)

 }
 
 SubShader 
 {
 Tags
 {
"Queue"="Transparent"
"IgnoreProjector"="False"
"RenderType"="Opaque"

 }

 
Cull Back
ZWrite On
ZTest LEqual
ColorMask RGBA
Fog{
}


 CGPROGRAM
#pragma surface surf BlinnPhongEditor  alpha decal:blend vertex:vert
#pragma target 2.0


sampler2D _Diffuse;
sampler2D _Alpha;
float4 _Color;

 struct EditorSurfaceOutput {
 half3 Albedo;
 half3 Normal;
 half3 Emission;
 half3 Gloss;
 half Specular;
 half Alpha;
 half4 Custom;
 };
 
 inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light)
 {
half3 spec = light.a * s.Gloss;
half4 c;
c.rgb = (s.Albedo * light.rgb + light.rgb * spec);
c.a = s.Alpha;
return c;

 }

 inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
 {
 half3 h = normalize (lightDir + viewDir);
 
 half diff = max (0, dot ( lightDir, s.Normal ));
 
 float nh = max (0, dot (s.Normal, h));
 float spec = pow (nh, s.Specular*128.0);
 
 half4 res;
 res.rgb = _LightColor0.rgb * diff;
 res.w = spec * Luminance (_LightColor0.rgb);
 res *= atten * 2.0;

 return LightingBlinnPhongEditor_PrePass( s, res );
 }
 
 struct Input {
 float2 uv_Diffuse;
float2 uv_Alpha;

 };

 void vert (inout appdata_full v, out Input o) {
float4 VertexOutputMaster0_0_NoInput = float4(0,0,0,0);
float4 VertexOutputMaster0_1_NoInput = float4(0,0,0,0);
float4 VertexOutputMaster0_2_NoInput = float4(0,0,0,0);
float4 VertexOutputMaster0_3_NoInput = float4(0,0,0,0);


 }
 

 void surf (Input IN, inout EditorSurfaceOutput o) {
 o.Normal = float3(0.0,0.0,1.0);
 o.Alpha = 1.0;
 o.Albedo = 0.0;
 o.Emission = 0.0;
 o.Gloss = 0.0;
 o.Specular = 0.0;
 o.Custom = 0.0;
 
float4 Tex2D1=tex2D(_Diffuse,(IN.uv_Diffuse.xyxy).xy);
float4 Add0=_Color + Tex2D1;
float4 Tex2D0=tex2D(_Alpha,(IN.uv_Alpha.xyxy).xy);
float4 Master0_1_NoInput = float4(0,0,1,1);
float4 Master0_2_NoInput = float4(0,0,0,0);
float4 Master0_3_NoInput = float4(0,0,0,0);
float4 Master0_4_NoInput = float4(0,0,0,0);
float4 Master0_7_NoInput = float4(0,0,0,0);
float4 Master0_6_NoInput = float4(1,1,1,1);
o.Albedo = Add0;
o.Alpha = Tex2D0.aaaa;

 o.Normal = normalize(o.Normal);
 }
 ENDCG
 }
 Fallback "Diffuse"
}