yes thats basiaclly what i am talking about. no i didnt update the code.. just change the shader to:
Code:
pass p0
{
//load matrices
VertexShaderConstant[0] = <matWorld>; //World Matrix
VertexShaderConstant[8] = <matWorldViewProj>; //World*View*Proj Matrix
VertexShaderConstant[95] = <matWorldView>; //World*View Matrix
//light vector
VertexShaderConstant[12] = <vecSkill17>;
//range constant
// VertexShaderConstant[33] = (0.0052f, 0.5f, 0.0f, 0.0f);
VertexShaderConstant[33] = (0.01f, 0.5f, 0.0f, 0.0f);
Texture[0] = <mtlSkin3>; //pointlight attenuation
Texture[1] = <mtlSkin3>; //pointlight alpha
AddressU[0] = clamp; // don't wrap around edges
AddressV[0] = Clamp;
AddressU[1] = Clamp; // don't wrap around edges
AddressV[1] = Clamp;
zWriteEnable=true; // enables writing to the z-buffer
AlphaBlendEnable=false; // disables alpha blending
VertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[3]; //uv
float v8[3]; //tangent
}
asm
{
vs.1.1
; position in clip space
m4x4 oPos, v0, c8
; position in world space
m4x4 r2, v0, c95
; get light vector
// add r10, r2, -c12
; Divide each component by the range value
// mul r10, r10, c33.x
mul r10,r2,c33.x
; multiply with 0.5 and add 0.5
mad r10, r10, c33.yyyy, c33.yyyy
mov oT0.xy,r10.xy
; map the x and y components into the first texture
// mov oT0.xyz, r10.xyz
; z-component v0
mov oT1.x, r10.z
};
PixelShader=
asm
{
ps.1.1
tex t0
tex t1
add r0, 1-t0, -t1.a
};
}
now this as i said will only work using the camera as the "projector".. i still dont know the matrix math the get it work for a point light