# Total instructions: 48

!!ARBvp1.0
OPTION ARB_position_invariant;

MOV	result.texcoord[0], vertex.attrib[8];

# Mask
SGE	result.texcoord[6].x, program.local[1].w, 1.5;
SGE	result.texcoord[6].y, program.local[2].w, 1.5;
SGE	result.texcoord[6].z, program.local[3].w, 1.5;
SGE	result.texcoord[6].w, program.local[4].w, 1.5;
SGE	result.texcoord[7].x, program.local[5].w, 1.5;
SGE	result.texcoord[7].y, program.local[6].w, 1.5;

# Megatexture level pos
MAD result.texcoord[1], vertex.attrib[8], 2, program.local[1];
MAD result.texcoord[2], vertex.attrib[8], 4, program.local[2];
MAD result.texcoord[3], vertex.attrib[8], 8, program.local[3];
MAD result.texcoord[4], vertex.attrib[8], 16, program.local[4];
MAD result.texcoord[5], vertex.attrib[8], 32, program.local[5];

# Texture pos
MUL result.texcoord[1].zw, vertex.attrib[8].xyxy, 2;
MUL result.texcoord[2].zw, vertex.attrib[8].xyxy, 4;
MUL result.texcoord[3].zw, vertex.attrib[8].xyxy, 8;
MUL result.texcoord[4].zw, vertex.attrib[8].xyxy, 16;
MUL result.texcoord[5].zw, vertex.attrib[8].xyxy, 32;

END

#======================================================================

!!ARBfp1.0
OPTION ARB_precision_hint_nicest;

TEMP finalColor;
TEMP color5, color4, color3, color2, color1, color0;
TEMP factor5, factor4, factor3, factor2, factor1, factor0;

# Set black color
MOV	finalColor, 0;

# Blend factor
TXB	factor1, fragment.texcoord[1], texture[7], 2D;
TXB	factor2, fragment.texcoord[2], texture[7], 2D;
TXB	factor3, fragment.texcoord[3], texture[7], 2D;
TXB	factor4, fragment.texcoord[4], texture[7], 2D;
TXB	factor5, fragment.texcoord[5], texture[7], 2D;

# Mask
MUL factor1, factor1, fragment.texcoord[6].x;
MUL factor2, factor2, fragment.texcoord[6].y;
MUL factor3, factor3, fragment.texcoord[6].z;
MUL factor4, factor4, fragment.texcoord[6].w;
MUL factor5, factor5, fragment.texcoord[7].x;

# Tex color
TXB color0, fragment.texcoord[0], texture[1], 2D;
TXB color1, fragment.texcoord[1].zwzw, texture[2], 2D;
TXB color2, fragment.texcoord[2].zwzw, texture[3], 2D;
TXB color3, fragment.texcoord[3].zwzw, texture[4], 2D;
TXB color4, fragment.texcoord[4].zwzw, texture[5], 2D;
TXB color5, fragment.texcoord[5].zwzw, texture[6], 2D;

# New blend factor
SUB factor0, 1, factor1;
SUB factor1, factor1, factor2;
SUB factor2, factor2, factor3;
SUB factor3, factor3, factor4;
SUB factor4, factor4, factor5;

# Blend
MAD finalColor, factor0, color0, finalColor;
MAD finalColor, factor1, color1, finalColor;
MAD finalColor, factor2, color2, finalColor;
MAD finalColor, factor3, color3, finalColor;
MAD finalColor, factor4, color4, finalColor;
MAD finalColor, factor5, color5, finalColor;

MOV	result.color.xyz, finalColor;

END