; Dot transformed vertex normals with light direction ; Clamp to 0 if negative ; Scale light colors with dot product #pragma screenspace xvs.1.1 mov r7.xyz, c[a0.x + LIGHT_COLOR].xyz ; Sum in this light's contribution (alpha + rgb) ; Clamp to 1.0. add r6.xyz, r11.xyz, r7.xyz mov r6.w, ONE.w min r11, r6, ONE ; We really need two color outputs for bump-map. ; OD0 should end up with the max color for the bump-map light term ; OD1 should end up with the color coming from other lights to be ; directly applied. ; cross product to finish our texture space transform mul r0, r9.yzx, r8.zxy mul r1, r9.zxy, r8.yzx sub r2, r0, r1 ; r2 holds our y-vector of our texture space ; now transform our geo-space light into texture space dp3 r7.x, r8, -c[a0.x + LIGHT_DIRECTION] ; x-vector dp3 r7.y, r2, -c[a0.x + LIGHT_DIRECTION] ; y-vector dp3 r7.z, r9, -c[a0.x + LIGHT_DIRECTION] ; z-vector mov r8, r7 ; use the nifty cubemap to normalize & interpolate! mov oT2, r8 ; Set a0.x to next light (if any) mov r5.x, c[a0.x + LIGHT_SIZE].w mov a0.x, r5.x