; first pass: diffuse ; v0 vertex ; v1 normal ; v2 tex coord ; c0 c1 c2 c3 worldviewproj matrix ; c4 c5 c6 world matrix ; c8 c9 texture matrix? ; c12 eye position ; c13 direct direction ; c14 0.0 0.5 1.0 2.0 ; c15 ambient ; c16 mat color ; c17 direct color ; c18 c19 c20 c21 extra directions ; c22 c23 c24 c25 extra colors ; c26 specular ; c27 spec, fresnel, 0.6, power dp3 r0.x, v1.xyzz, c4.xyzz ; normal to world space -> r0 dp3 r0.y, v1.xyzz, c5.xyzz ; dp3 r0.z, v1.xyzz, c6.xyzz ; dp4 r3.x, v0, c4 ; transform pos to world dp3 r0.w, r0.xyzz, r0.xyzz ; square world normal +mov oT0.xy, v2.xyyy ; output tex coords0 dp4 r3.y, v0, c5 ; transform pos to world dp4 r3.z, v0, c6 ; transform pos to world +rsq r1.w, r0.w ; get factor to normalize normal add r2.xyz, c12.xyzz, -r3.xyzz ; subtract posworld from eye mul r0.xyz, r0.xyzz, r1.w ; r0.xyz: normalized world-normal dp3 r2.w, r2.xyzz, r2.xyzz ; square view vector dp3 r0.w, r0.xyzz, -c13.xyzz ; direct light intensity dp3 r11.w, r0.xyzz, -c18.xyzz ; light1 intensity +rsq r1.w, r2.w ; get factor to normalize view vector max r0.w, r0.w, c14.x ; clamp direct light mul r2.xyz, r2.xyzz, r1.w ; r2: normalized world-view-vector dp3 r7.x, r2.xyzz, r0.xyzz ; V dot N mul r8.xyz, r0.w, c16.xyzz ; direct color max r5.x, r7.x, c14.x ; clamp V dot N mov r11.xyz, c16 +mov oD0.w, c16 ; output alpha max r0.w, r11.w, c14.x ; clamp light1 dp3 r11.w, r0.xyzz, -c19.xyzz ; light2 intensity mul r6.x, r7.x, c14.w ; a = 2*(V dot N) add r5.x, c14.z, -r5.x ; b = 1 - V dot N mad r8.xyz, c15.xyzz, r11.xyzz, r8.xyzz ; add ambient color mul r6.yzw, r0.w, c22.yyzx ; light1 color max r0.w, r11.w, c14.x ; clamp light2 dp3 r11.w, r0.xyzz, -c20.xyzz ; light3 intensity mad r11.xyz, r6.x, r0.xyzz, -r2.xyzz ; U = a*N - V mul r6.x, r5.x, r5.x ; a = b*b dp4 r10.y, v0, c0 ; transform vertex dp4 r10.z, v0, c1 ; dp4 r10.x, v0, c2 ; +dp4 oFog.x, v0, c2 ; output fog mad r8.xyz, r6.wyzz, c16.xyzz, r8.xyzz ; add light1 mul r6.yzw, r0.w, c23.yyzx ; light2 color +mov oPos.xyz, r10.yzxw ; output vertex max r0.w, r11.w, c14.x ; clamp light3 dp3 r0.x, r0.xyzz, -c21.xyzz ; light4 intensity dp3 r11.x, r11.xyzz, c8.xyzz ; multiply by tex matrix mul r6.x, r6.x, r6.x ; a = a*a mov r11.w, c27.y ; fresnel dp4 oPos.w, v0, c3 ; output vertex mad r8.xyz, r6.wyzz, c16.xyzz, r8.xyzz ; add light2 mul r6.yzw, r0.w, c24.yyzx ; light3 color +rcc r1.x, r12.w max r0.w, r0.x, c14.x ; clamp light4 dp3 r11.y, r11.xyzz, c9.xyzz ; multiply by tex matrix mul r5.x, r5.x, r6.x ; b = b*a add r7.x, c14.z, -r11.w ; 1 - fresnel mad r8.xyz, r6.wyzz, c16.xyzz, r8.xyzz ; add light3 mul r6.xyz, r0.w, c25.xyzz ; add light4 mul r11.yw, r11.yyyx, c14.y mad r5.x, r7.x, r5.x, c27.y ; (1-fresnel)*b + fresnel mul oPos.xyz, r12.xyzz, c-38.xyzz mad oD0.xyz, r6.xyzz, c16.xyzz, r8.xyzz ; add light4, output color add oT1.xy, r11.wyyy, c14.y mul oD1, r5.x, c27.x ; output color2 mad oPos.xyz, r12.xyzz, r1.x, c-37.xyzz