PDA

View Full Version : depth component able to select a mipmap?



inept
11-29-2002, 05:14 AM
When a poly is being rasterized, for each pixel opengl decides which mipmap level to sample from based on some distance-from-the-eye/angle-to-the-eye kind of calculation, yes?
Is there anyway to get opengl to select the mipmap level for the pixel about to be drawn from the current fragments depth value? (I mean the fragment already in the framebuffer) ?

pbrown
11-29-2002, 10:50 AM
Originally posted by inept:
When a poly is being rasterized, for each pixel opengl decides which mipmap level to sample from based on some distance-from-the-eye/angle-to-the-eye kind of calculation, yes?

No. The spec calls for LOD computations to be done using partial derivatives: d{u,v,w}/d{x,y}. Basically, the idea is: figure out how much we move in texel space for each screen-space pixel and select the LOD(s) closest to a 1:1 match.



Is there anyway to get opengl to select the mipmap level for the pixel about to be drawn from the current fragments depth value? (I mean the fragment already in the framebuffer) ?

No.

inept
11-29-2002, 12:43 PM
Thanks.
I've just been reading the arb_fragment_program extension spec, and it seems to suggest that this is possible. Is it possible with this extension?

Humus
11-29-2002, 03:16 PM
You can read and write the current fragments depth value in a fragment program which is going to be written into the depth buffer when the fragment program is done. You cannot however read the depth value stored in the depth buffer.