//#include "Constants.h" vs.1.1 //fades a projected shadow texture the farther it gets away from a light // Scale the vertex position by the heightmap dimensions mul r3, v0, c[8] // transform position dp4 oPos.x, r3, c[0] dp4 oPos.y, r3, c[1] dp4 oPos.z, r3, c[2] dp4 oPos.w, r3, c[3] // Now we'll generate UVs for texture channel 1. This will be used to fade out the // shadow the further away from the center of the object it is. // We do this by getting the offset of this vertex from the center, scaling this by // the maximum shadow distance, and offseting it by 0.5 so that 0 distance lies in // the center of the Fade texture. sub r0, r3, c[33] // Get the offset of the vertex from the center of the shadow, store it in r0 mad r0.xy, r0.xz, c[32].xx, c[32].yy // Divide the offset by the maximum shadow range, and add 0.5 max r0.xy, r0.xy, c[32].zz // Raise to 0 if negative min r0.xy, r0.xy, c[32].ww // Raise to 0 if negative mov r0.zw, c[32].ww mov oT1, r0 mov oD0, c[34] // Set the diffuse color of the vertex // Calculate the UVs for the shadow texture itself dp4 oT0.x, r3, c[28] dp4 oT0.y, r3, c[29] dp4 oT0.z, r3, c[30] dp4 oT0.w, r3, c[31]