Original Post
Hi,
I'm currently working on shadow mapping for point light but i don't get it to works..
My lighting shader works in view-space.
I do 6 render of the cube map like that :
ShadowFactor :
In WorldSpace i do like that :
I've read that ShadowMap should be world space, can it to work in view space ?
Can you explain me a good way to have point light shadow mapping working ?
Thanks for your help
I'm currently working on shadow mapping for point light but i don't get it to works..
My lighting shader works in view-space.
I do 6 render of the cube map like that :
OutColor = vec4( length( LightPosition - OutWorldViewPos.xyz ), 0.0, 0.0, 1.0 );ShadowFactor :
float ShadowMapDepth = texture( ShadowMap, LightVecViewSpace ).r;
float ShadowFactor = ( length( LightVecViewSpace ) > ShadowMapDepth ) ? 0.0 : 1.0;In WorldSpace i do like that :
vec4 PositionWS = InverseView * vec4( Position, 1.0 );
vec4 LightPosWS = InverseView * vec4( LightPosition, 1.0 );
vec3 LightVecWS = LightPosWS.xyz - PositionWS.xyz;
float s0 = texture( ShadowMap, LightVecWS ).r;
float ShadowFactor = ( length( LightVecWS ) > s0 ) ? 0.0 : 1.0;I've read that ShadowMap should be world space, can it to work in view space ?
Can you explain me a good way to have point light shadow mapping working ?
Thanks for your help