简体   繁体   中英

What coordinate system does a depth texture use?

I have a depth texture and I would like to know in which coordinate system are the values stored inside the depth texture. Homogeneous coordinates, camera coordinates, world coordinates or model coordinates?

I also would like to know what values are stored in the depth texture and what do they mean.

Thanks.

This should be a value in range [ min , max ] where min is either -1.0 or 0.0 and max is 1.0 though what you get from the texture might simply be an integer value which might need to be transformed (from 24-bit to 32-bit). If none confirms any of these you will need to test it yourself.

Anyway, these values min and max should represent the clipping planes so min = near and max = far due to the depth buffer optimisation. To get the true Z value from texture coordinate ZT then:

Z = near + ((far-near) * ((ZT-min)/(max-min)))

This Z then represents the distance from (0,0,0) from the user perspective this is the distance between object and the camera position.

Try looking for some literature .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM