简体   繁体   English

深度纹理使用什么坐标系?

[英]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). 该值应该是[ minmax ]范围内的一个值,其中min可以是-1.00.0max1.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. 无论如何,这些值minmax应该代表剪切平面,因此由于深度缓冲区的优化, min = nearmax = 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.

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