# GL_ARB_depth_texture

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

## Recommended Posts

I wanted to use this extension to make shadows, got really confused, and Im trying to sort it out, but... for now I dont know why Im getting a very white depth texture, and I thought of scaling this ussing glPollygonOffset() but Its completly useless(I wasnt able to figure out any good values). The thing is that if I have 2 boxes in front of me at about 10-20 meters each, the depth texture will probably see the begining of the first one, and everything else is completely white(probably because precision ?) although 16-24-32 bit still works the same. Oh and... is there no other way to project the shadow texture without using the glTexGen ? eventually through some vertex/fragment programs ?

##### Share on other sites
Quote:
 Original post by cippyboyI wanted to use this extension to make shadows, got really confused, and Im trying to sort it out, but... for now I dont know why Im getting a very white depth texture, and I thought of scaling this ussing glPollygonOffset() but Its completly useless(I wasnt able to figure out any good values). The thing is that if I have 2 boxes in front of me at about 10-20 meters each, the depth texture will probably see the begining of the first one, and everything else is completely white(probably because precision ?) although 16-24-32 bit still works the same.

a couple of screen shots highlighting the problem + setup code would be handy...

Quote:
 Oh and... is there no other way to project the shadow texture without using the glTexGen ? eventually through some vertex/fragment programs ?

yep, you can do it via vertex and fragment program/shaders, but keep in mind then you have todo ALL the work (generation of texture coords etc), however that isnt that hard.

##### Share on other sites
Ok, here are 2 pictures, the original image and my depth buffer which now is even more scaled, what a crap...
Original Image
Depth Texture

##### Share on other sites
hi, you have the exact same "problem" i had, i quoted problem because its not a problem :-) its simply that the Z Buffer isnt linearly stored, so stuff really close to the ZNear plane maps to a visible grayscale range, while stuff way down the back (near ZFar) are depth values like 0.988f (ie, really close to white!)

this should be fine for shadowmapping, because you're just comparing the Z values (lookup table of sorts), not really using them for visualisation on screen.

here's my thread, should answer a few more questions [opens in new window]

##### Share on other sites
Aha, I thought to myself that outta do it but... Ive put 1.0f for zNear and just 10 for zFar, guess what ? almost nothing changed. To see what im talking about see again those 2 pictures, theyre slightly modifyed, the gray color is my clearvalue to see that the zFar is 10 and no more(making the world really crappy)

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632918
• Total Posts
3009204
• ### Who's Online (See full list)

There are no registered users currently online

×