3 PARAM light0color = state.light[0].diffuse;
\r
4 PARAM light1color = state.light[1].diffuse;
\r
5 PARAM ambient = state.lightmodel.ambient;
\r
8 TEMP rgb, normal, height, temp, bump, total;
\r
9 TEMP light0tsvec, light1tsvec;
\r
12 # normalize tangent space eye vector
\r
13 DP3 temp, fragment.texcoord[3], fragment.texcoord[3];
\r
15 MUL eyevects, fragment.texcoord[3], temp;
\r
17 # calculate offset and new texture coordinate
\r
18 TEX height, fragment.texcoord[0], texture[2], 2D;
\r
19 MAD height, height, 0.04, -0.02; # scale and bias
\r
20 MAD newtexcoord, height, eyevects, fragment.texcoord[0];
\r
23 TEX rgb, newtexcoord, texture[0], 2D;
\r
24 TEX normal, newtexcoord, texture[1], 2D;
\r
26 # remove scale and bias from the normal map
\r
27 MAD normal, normal, 2.0, -1.0;
\r
29 # normalize the normal map
\r
30 DP3 temp, normal, normal;
\r
32 MUL normal, normal, temp;
\r
34 # normalize the light0 vector
\r
35 DP3 temp, fragment.texcoord[1], fragment.texcoord[1];
\r
37 MUL light0tsvec, fragment.texcoord[1], temp;
\r
39 # normal dot lightdir
\r
40 DP3 bump, normal, light0tsvec;
\r
43 MUL_SAT total, bump, light0color;
\r
45 # normalize the light1 vector
\r
46 DP3 temp, fragment.texcoord[2], fragment.texcoord[2];
\r
48 MUL light1tsvec, fragment.texcoord[2], temp;
\r
50 # normal dot lightdir
\r
51 DP3 bump, normal, light1tsvec;
\r
54 MUL_SAT bump, bump, light1color;
\r
55 ADD_SAT total, total, bump;
\r
57 # add ambient lighting
\r
58 ADD_SAT total, total, ambient;
\r
60 # multiply by regular texture map color
\r
61 MUL_SAT result.color, rgb, total;
\r