ps.2.0
//tex t0
//tex t1
//tex t2

	

dcl v0.rgba
dcl	t1	; Normal
dcl	t3	; Cubic Normalized Tangent Space Halfangle vector
dcl_2d s1
;dcl_2d s3

texld	r0,t1,s1
;texld	r1,t3,s3

mad r1,r0,c2.y,c2.z
;mad r1,r1,c2.y,c2.z

;dp3 r3.x,t3,t3
;rsq r3.x,r3.x
;mul r3,t3,r3.x

dp3_sat r1.xyzw, r1, t3  ; N.H
pow	r1.xyzw,r1.x,c2.x
mul	r1,r1,r0.w
;mul	r0,r1,v0
mov	oC0,r1


//	tex t0      ; Base
;	tex t1      ; Normal
//	tex t2      ; Cubic Normalized Tangent Space Light Direction
;	tex t3      ; Cubic Normalized Tangent Space Halfangle vector

;	dp3_sat r1, t1_bx2, t3_bx2  ; N.H

; approximate (N. H)^ 16
; [( N. H)^ 2 - 0. 75] * 4 == (N. H)^ 16 

;mad_x4_sat r1, r1, r1, c2 	;16
;mul r1, r1, r1		;32
;mul r1, r1, r1	;64


;	mul     r1.a, r1.a, r1.a    ; N.H^2
;	mul     r0.a, r1.a, r1.a    ; N.H^4
;	mul     r1.a, r0.a, r0.a    ; N.H^16
;	mul     r1.a, r1.a, r1.a    ; N.H^64
//	mul     r1.a, r1.a, r1.a    ; N.H^128

;	mul     r1, 1-t1.a, r1.a    ; Gloss map * specular highlight
;	mov_x4_sat	r0,v0
;	mul	r0,r0,r1
