[英]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). 该值应该是[
min
, max
]范围内的一个值,其中min
可以是-1.0
或0.0
, max
是1.0
尽管从纹理中获得的值可能只是一个整数值,可能需要转换(从24位到32位)位)。 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. 无论如何,这些值
min
和max
应该代表剪切平面,因此由于深度缓冲区的优化, min = near
和max = far
。 To get the true Z
value from texture coordinate ZT
then: 要从纹理坐标
ZT
获得真实的Z
值,则:
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. 然后,此
Z
代表从用户角度到(0,0,0)
距离,这是对象与相机位置之间的距离。
Try looking for some literature . 尝试寻找一些文学作品 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.