PDA

View Full Version : Issues with depthmaps



Mars_999
12-29-2005, 03:15 AM
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

tamlin
12-29-2005, 04:16 AM
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.

spasi
12-29-2005, 04:52 AM
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.

Mars_999
12-29-2005, 09:51 AM
Originally posted by spasi:
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.Thanks spasi that worked.

Mars_999
12-29-2005, 10:36 AM
Originally posted by Mars_9999:

Originally posted by spasi:
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.Thanks spasi that worked.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:

tamlin
12-31-2005, 04:32 AM
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).

Mars_999
12-31-2005, 10:03 AM
Originally posted by tamlin:
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).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...

gulgi
01-01-2006, 01:50 AM
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!

Jan
01-02-2006, 12:49 AM
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.

Mars_999
01-02-2006, 09:55 AM
Originally posted by Jan:
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.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?

Jan
01-02-2006, 03:29 PM
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.