ps.1.4
// Intensity in shadow
def c4, 0, 0, 0, 0
// Intensity in the light
def c6, 1, 1, 1, 1
// Fudge factor for back face occlusion
def c2, 0.1, 0, 0, 0
// Sample weights (1/4)
def c3, 0.25, 0.25, 0.25, 0.25
// Ambient color
;def c4, 0.25, 0.25, 0.25, 0.5
def c5, 1.0, 0.0, 0.0, 0.0


texld r0,t0	//shadow map
texld r1,t1	//Normal
texld r2,t2	//Cubic Normalized Tangent Space Light Direction
// Light space depth from vertex shader
texcrd r3.rgb,t3

// Unpack sample 0
;dp3 r0.rgba,r0,c5
;mov r0.rgba,r0.r
// Compare shadow map samples to surface depth
;mov r0.rgb,r3
sub r0, r3.r, r0.r
cmp r0, -r0, c6, c4

// Occlude back facing prims with respect to light
sub r5.r, v0.a, c2.r
cmp r3, r5.r ,r0, c4

dp3_sat r0.rgb, r1_bx2, r2_bx2  ; N.L
mul r0,r0,r3
mad_x2 r0.rgb,r0,v0,c0

