I’m starting to explore the “depth texture” term ans it usage and found that there are several ways to create such type of texture but what i actually want - use the texture instead of z-buffer for depth comparison. Putting the texture into depth buffer seems to be too slow. Can someone explain how to perform depth test of scene with data which i have already prepared in some way? Please…
I think drawing to the depth buffer is your only hope. I know it can be done using DrawPixels.
I am also thinking whether there is a way to do it by drawing a quad textured with your depth texture. Short of using fragment progtrams, I think not.
Unfortunatelly using glDrawPixels drop the frame rate below 20 fps and no matter how powerfull GeForce board i use… There are must be the way to do this quicker… i hope…
Light comes on above head…
If you are on nVidia hardware, look into NV_pixel_data_range. It is supported on TNT and above. I haven’t had more than a brief scan of the extension, but it might be what you need.
unfortunatelly i don’t have this extention on my GeForce4 with 30.82 driver. I search the net and not found any usefull information about it. It seems like this extension not usable any more… But maybe some one know how to fill depth buffer using depth_replace pixel shader operation? Or something about this?
This extension is new, your drivers are too old to support it. All the information you need is at developer.nvidia.com
Also, have a look at the paper/presentation on order-independent transparency. I’m sure they use the Dot-Depth-Replace function of NV_texture_shader in order to do something similar.
Writing the depth texture to the depth buffer is slow, there is nothing you can do about that. But it might not be neccessary to write to the depth buffer at all.
What you want to do seems very similar to shadow mapping.
Shadow mapping renders with a depth texture projected from the lightsource and compares the fragment-lightsource distance to the depth texture value.
If you do exactly the same with the camera instead of the light source, you should get the correct result. You compare the camera-fragment distance to the value in the depth texture, thats exactly the same as a standard depth test, just not with the depth buffer but with the depth texture.
A simple search on the forum or on google should give you plenty material on shadow mapping.
[This message has been edited by Overmind (edited 10-27-2002).]