Skip to main content
gamedev.net
🔒 Locked

CubeMap ShadowMap

Started by Alundra 0 replies 850+ views
Original Post
Alundra
Alundra
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 :
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.