Converting Fixed Function Shader to Surface Shader

Hi everyone,

I am trying to convert a custom fixed function shader to a surface shader to get realtime shadows working but I am stuck on one command, which is

SetTexture [_MainTex] 
    Combine previous * primary DOUBLE

The previous part is

fixed4 c = tex * _Color;

but I am not sure what primary and DOUBLE equate to. I hope someone can help.


I have been playing around with the surface shader to make the lightning calculations look the similar to the ones produced by the fixed function shader. This is the surface shader I ended up with, it looks hacked, but at least in the game it looks the same and receiving shadows works properly now.

I used the Self-Illumination/Diffuse Shader as a starting point.

void surf (Input IN, inout SurfaceOutput o) 
    fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
    fixed4 c = tex * _Color * 0.5; //Why 0.5? I tried to match the lighting
                                   //on a white sphere first and this worked
                                   //but it was just a guessed number
    o.Albedo = c.rgb;
    o.Emission = c.rgb * tex2D(_Illum, IN.uv_Illum).a;

    o.Albedo = o.Albedo * 0.5865;     //These two values are magic numbers I just
    o.Emission = o.Emission * 1.173; //found through trial and error

    o.Albedo = o.Albedo * 2; //This is the DOUBLE part
    o.Emission = o.Emission * 2;

    o.Alpha = c.a;


ShaderLab syntax references:

Primary and DOUBLE are related to texturing: