;file field.vsh ; INPUT REGISTERS ; ; v0 Position ; v2 Normal ; v3 Vertex Colour ; CONSTANTS ; ; c10.w Effect strength ; c6 ... c9 World Matrix. ; c5 View vector ; c1 ... c4 Transform matrix ; c0 Screenspace transform offset ; TEMPS ; ; r1 ILU ; r2 Position ; r3 Accumulated Position ; r4 Normal ; r5 Accumulated Normal ; r6 Diffuse Clamp ; r11 Diffuse Colour xvs.1.1 #pragma screenspace ; Transform ----------------------------------------------------------------------------------- ; Transform position ; Combined camera & projection & screenspace scale matrix m4x4 oPos, v0, c1 ;trick from the xds.graphics newsgroup - copy the output pos.w to fog ;mov oFog.x, r12.w ;dph is done by now ;compute 1/w rcc r1.x, r12.w ;multiply 1/w through position & add screen space transform offset mad oPos.xyz, r12, r1.x, c0 ; ; Compute glow on field. ; ; Take the normalised distance from eye to vertex, and dot with ; the normal. ; Transform vertex to world space m4x3 r2, v0, c6 ; c5 = camera pos sub r2.xyz, c5, r2 ; r2 = view vector dp3 r3, r2, r2 rsq r3, r3 mul r2.xyz, r2, r3 ; r2 = normalize(r2) ;dp3 r3, v2, r2 ; r3 = N dot V ;sub r2, v0.w, r3 ; 1 - N dot V sub r2, v0.w, r2.y ; 1 - N dot V. N = {0, 1, 0} mul oT0.xy, r2, r2 ; squared mul oD0, v3, c10.w ; vertex colour