!!ARBfp1.0
OUTPUT final = result.color;
TEMP base, normal, temp, bump, total;
TEMP light1, atten1;
TEMP light2, atten2;
PARAM light0colour = state.light[0].ambient;
#PARAM light1colour = state.light[1].diffuse;
PARAM light1colour = {0.0, 1.0, 0.0, 1.0};
#PARAM light2colour = state.light[2].diffuse;
PARAM light2colour = {1.0, 0.0, 0.0, 1.0};
TEX base, fragment.texcoord[0], texture[1], 2D;
TEX normal, fragment.texcoord[0], texture[0], 2D;
# remove scale and bias from the normal map
SUB normal, normal, 0.5;
MUL normal, normal, 2.0;
# normalize the normal map
DP3 temp, normal, normal;
RSQ temp, temp.r;
MUL normal, normal, temp;
# normalize the light1 vector
DP3 temp, fragment.texcoord[1], fragment.texcoord[1];
RSQ temp, temp.x;
MUL light1, fragment.texcoord[1], temp;
# N.L
DP3 bump, normal, light1;
# calculate and add attenuation
DP3_SAT atten1, fragment.texcoord[2], fragment.texcoord[2];
SUB atten1, 1.0, atten1;
MUL bump, bump, atten1;
# add colour
MUL total, bump, light1colour;
# normalize the light2 vector
DP3 temp, fragment.texcoord[3], fragment.texcoord[3];
RSQ temp, temp.x;
MUL light2, fragment.texcoord[3], temp;
# N.L
DP3 bump, normal, light2;
# calculate and add attenuation
DP3_SAT atten2, fragment.texcoord[4], fragment.texcoord[4];
SUB atten2, 1.0, atten2;
MUL bump, bump, atten2;
# add colour and add to the total
MAD_SAT total, bump, light2colour, total;
# add ambient lighting
ADD_SAT total, total, light0colour;
MUL_SAT total, base, total;
MOV final, total;
#MOV final, bump;
END