PDA

View Full Version : check if shadow map is correct



JanHH
05-26-2005, 03:50 PM
Hello,

when doing shadow mapping, rendering a scene from the light's point of view and copying this to a depth map texture, how can one check if this is working right, and the resulting texture is correct?

It seems that the data format of the depth map is weird.. I suppose it is a 24 bit (geforce fx) floating point value, is this right?

Regards,
Jan

stanlylee
05-26-2005, 04:50 PM
I think you could find the answer in the Red book (4th Edition).

zed
05-26-2005, 04:51 PM
define wierd?
u should be able to view the depthtexture normally, keep in mind most(all) the values are gonna be very high > 0.99 thus the texture will appear white. u can fix that by pushing the near plane out quite a bit eg near == 100 far == 1000

JanHH
05-26-2005, 07:44 PM
I just tried to figure out what format the data is in. It looks like it is a 24 bit integer for each texel, but the bytes corresponding to the same texel (most significant, medium and least significant bytes) are not sittiing next to each other, but the first third of the texture size is the most significant byte for all texels, the second third is the medium and the 3/3 the least significant byte. I think this is weird ;) . Maybe I am wrong but I tried to fill the depth texture in the paulsprojects tutorial with a grey shade for testing purposes, and that is the way this works.

Jan

arekkusu
05-26-2005, 09:54 PM
Try your code on ATI hardware and see if the results make sense.

def
05-28-2005, 12:54 AM
Sounds to me you are using the wrong texture setup for the depth texture. I had the same problem and this did it for me:

glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_DEPTH_COMPONENT24_ARB, WIDTH, HEIGHT, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0);

JanHH
06-01-2005, 04:33 PM
I use the same as in the tutorial, which is:

glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadowMapSize, shadowMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);

Shadow mapping does not work yet, my boss is getting desperated ;) . I will have to go on trying.