Jump to content
  • Advertisement
Sign in to follow this  

CubeMap ShadowMap

This topic is 2898 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!