1!!FP1.0
2
3# Diffuse bump map + texture
4# Base texture in tex 0
5# Normal map in tex 1
6
7# Ambient color in constant 5
8
9# Get the base texture color
10TEX H0, f[TEX0], TEX0, 2D;
11
12# Get the normal map value
13TEX H1, f[TEX1], TEX1, 2D;
14
15# Unpack the unsigned texture components into a normal
16MADX H1, H1, 2.0, -1.0;
17
18# The diffuse color contains the tangent space normal; unpack it into H2
19MADX H2, f[COL0], 2.0, -1.0;
20
21# Compute the diffuse term
22DP3X H3.w, H1, H2;
23
24# Compute the self shadowing term--multiplying by a factor of 8 gives
25# a steep ramp function
26MULH_SAT H1.w, H2.z, 8.0;
27
28# Add the product of the diffuse and self shadowing terms to the
29# ambient color.
30MADX H3.xyz, H1.w, H3.w, p[5];
31
32MULX H0.xyz, H3, H0;
33
34MOVX o[COLR], H0;
35
36END
37
38