Depth Map resolution shifting

Posted by user3669538 on Game Development See other posts from Game Development or by user3669538
Published on 2014-06-02T18:27:54Z Indexed on 2014/06/02 21:49 UTC
Read the original article Hit count: 163

the problem is with shadow mapping as you can see,

actually it works fine but in a certain condition that the Depth Map size must be equal to the size of rendering buffer, I use an infinite directional light

so if the window is 800x600 the depth map must be 800x600, and when i change the size of the shadow map to be 900x600 it starts to be shifted and when it's size be 1024x1024 it also shifts till it disappears

the GLSL shadow function

float calcShadow(sampler2D Dmap, vec4 coor){

vec4 sh = vec4((coor.xyz/coor.w),1);
sh.z *= 0.9;
return step(sh.z,texture2D(Dmap,sh.xy).r);
}

here's the result when it's the same size as the window

Colored result & Depth Map Colored resultDepth Map

and here's the shifted result, as you can notice the depth map is exactly as the previous one with the addition of white space to the right.

Colored result http://goo.gl/5lYIFV

Depth Map http://goo.gl/7320Dd

© Game Development or respective owner

Related posts about opengl

Related posts about shaders