Issues with depthmaps

I am having a nightmare with these two functions on my Nvidia card.

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);

if I use them my depthmap has an equal intensity but the single quad I render to verify my depths shows nothing but the depthmap must be working for my shadows and transparency show up. Now if I take them out my depthmap shows up in the quad to verify my depths and still renders fine, but my shadows are darker near the light source and lighter as they objects get further away from the light source. Now on ATI hardware these functions work fine either way and the depthmaps showup on my single quad. I checked this using FBO’s and glCopyTexImage2D() and they both act the same way??? I am out of ideas other than someones drivers are at fault. Any ideas would be greatly welcomed. Thanks

Assuming (!) you have checked all gl calls, and not a single one fails on either architecture, it’d look like a driver error. Notify the vendor and hope for them to remove the bug.

When you want to inspect the depth map values, apply the following params:

GL_TEXTURE_COMPARE_MODE, GL_NONE
GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE

and rollback to GL_COMPARE_R_TO_TEXTURE_ARB when rendering your scene.

Originally posted by spasi:
[b]When you want to inspect the depth map values, apply the following params:

GL_TEXTURE_COMPARE_MODE, GL_NONE
GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE

and rollback to GL_COMPARE_R_TO_TEXTURE_ARB when rendering your scene.[/b]
Thanks spasi that worked.

Originally posted by Mars_9999:
[b] [quote]Originally posted by spasi:
[b]When you want to inspect the depth map values, apply the following params:

GL_TEXTURE_COMPARE_MODE, GL_NONE
GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE

and rollback to GL_COMPARE_R_TO_TEXTURE_ARB when rendering your scene.[/b]
Thanks spasi that worked.[/b][/QUOTE]Spoke to soon. Now my ATI card acts like the NVIDIA card did with the idea you gave me… when using glCopyTexImage2D() but with FBO’s it renders fine… Good grief can’t they just get along.
:confused:

Unless I’m mistaken, Humus wrote a post about this very issue well over six months ago in this forum - what is it to be, R or something else?

Iff my memory is correct, and it indeed was in this area, this is still an ARB issue as of yet unresolved (and, perhaps, noone even bothered to check into it).

Originally posted by tamlin:
[b]Unless I’m mistaken, Humus wrote a post about this very issue well over six months ago in this forum - what is it to be, R or something else?

Iff my memory is correct, and it indeed was in this area, this is still an ARB issue as of yet unresolved (and, perhaps, noone even bothered to check into it).[/b]
Hmm I searched and couldn’t find it. If you would be so kind and let me know if you find it? Humus is on vacation back home for a few weeks I heard…

What is strange is on both Nvidia/ATI I am using shadow2DProj which is supposed to return 0 or 1 if I remember right and on ATI it must be due to my shadows are equally intense. Now on Nvidia this isn’t the case, it’s like it’s not even doing the conditional to say it’s 0 or 1 but passing the shadowmap through and shows my shadows are dark to light on the terrain. As of now I am not sure but under the assumption that the

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);

do nothing for me when I use FBOs or glCopyTexImage2D() when using GLSL… Is this correct? If so then it must be an Nivida thing due to those functions have no effect on GLSL’s shadow functions…

Hi…

I use glCopyTexImage2D and GLSL (and pbuffers ;]) and shadows work as they should. the R bein’ 0 or 1.

FBO:s shouldn’t matter, coz that is only used when you are creating the shadow-texture, right?

Is the shadowtexture correct?
Does your code work with fixed function shadowmapping…?

Good luck!

Not sure, if this has anything to do with it, but nVidia is very proud that their cards support “percentage closer filtering” on shadow-maps, when you enable bilinear filtering on them. That means they take 4 samples of the shadow-map and return the average result. ATI however, does not support this.

You said you should get the binary result 0 or 1 when fetching your shadow-map, but on nVidia this might be not the case, if you have bilinear filtering enabled for your shadow-maps. Maybe that’s what causes the trouble.

Jan.

Originally posted by Jan:
[b]Not sure, if this has anything to do with it, but nVidia is very proud that their cards support “percentage closer filtering” on shadow-maps, when you enable bilinear filtering on them. That means they take 4 samples of the shadow-map and return the average result. ATI however, does not support this.

You said you should get the binary result 0 or 1 when fetching your shadow-map, but on nVidia this might be not the case, if you have bilinear filtering enabled for your shadow-maps. Maybe that’s what causes the trouble.

Jan.[/b]
Thanks for the replies. Gulgi my shadowmap looks correct, but the pixels that are in the shadowmap should be black or white correct? Well mine are showing up as greyscaled depending on where the units are on the terrain in relation to the lightsource…

I tried using GL_NEAREST and the shadows did become more blocky, where as the GL_LINEAR cause me to have smoother edge around the shadow volume. So unless their is someother way to turn off the sampling I am assuming this is done as its getting the depth values from the depth buffer and then samples them and saves them to my shadowmap?

No, the shadowmap should always be the same, but when fetching texel from a depth-map when bilinear filtering is enabled, returns a different result.

Well, that should be how it works. But maybe it nVidia implemented it differently? I don’t know, i never tested it.