ps_2_0
// tex0 - bump map
// tex1 - surface texture
//   c0 - light source xy, power = z
//   c1.xy - texture dimensions
dcl t0
dcl_2d s0
dcl_2d s1
def c8,1,0,0,0
rcp r1.x,c1.x
rcp r1.y,c1.y
texld r2,t0,s0
mov r0,t0
add_sat r0.x,r0.x,r1.x
texld r3,r0,s0
mov r0,t0
add_sat r0.y,r0.y,r1.y
texld r4,r0,s0
sub r2.x,r2.x,r3.x
sub r2.y,r2.y,r4.x
mov r2.z,c8.x
mov r2.w,c8.y
nrm r0,r2
sub r1,c0,t0
mov r1.z,c0.z
mov r1.w,c8.y
nrm r2,r1
dp3 r0.x,r0,r2
texld r2,t0,s1
mul r2,r2,r0.x
mov oC0,r2

