It didn't fix it by itself. The problem isn't only in VS_SHADOWMAP, but also in VS_GENERAL. In case of deferred lighting it puts wrong position into gbuffer.
The problem seems to come from vertSkinning.glsl, from this function:
Code:
vec4 skinPos( const vec4 pos, const mat4 skinningMat )
{
return pos * skinningMat;
}
changing it to:
Code:
vec4 skinPos( const vec4 pos, const mat4 skinningMat )
{
vec4 npos = pos * skinningMat;
return vec4(npos.xyz/npos.w,1.0);
}
together with your change to VS_SHADOWMAP, finally made both casting and receiving shadows correct. Now, i don't understand exact mechanism of what's going on, but it seems that with skinning, pos.w isn't always exactly 1, so gl_Position=viewProjMat*pos still computes correct position, but things like lightVec=lightPos.xyz-pos.xyz don't.
EDIT: works in game
http://www.youtube.com/watch?v=q99euNflHos , also going to test it with chicago guy and some other models.
EDIT2: Everything else works too.