从标准化设备坐标到视图空间的映射
我想从标准化设备坐标映射回视空间。
另一种方式是这样工作的:
viewspace ->裁剪空间:齐次坐标乘以投影矩阵
裁剪空间 ->标准化设备坐标:将 (x,y,z,w) 除以 w
现在在标准化设备坐标中,视锥体内的所有坐标都落入立方体 x,y,z € [-1,1] 且 w=1
现在我想将该立方体边界上的一些点转换回视图坐标。投影矩阵是非奇异的,因此我可以使用逆矩阵从剪辑空间到视空间。但我不知道如何从标准化设备空间到剪辑空间,因为我不知道如何计算需要与其他坐标相乘的“w”。
有人可以帮我吗?谢谢!
I'd like to map from normalized device coordinates back to viewspace.
The other way arround works like this:
viewspace -> clip space : multiply the homogeneous coordinates by the projection matrix
clip space -> normalized device coordinates: divide the (x,y,z,w) by w
now in normalized device coordinates all coordinates which were within the view frustum fall into the cube x,y,z € [-1,1] and w=1
Now i'd like to transform some points on the boundary of that cube back into view coordinates. The projection matrix is nonsingular, so I can use the inverse to get from clipsace to viewspace. but i don't know how to get from normalized device space to clipspace, since i don't know how to calculate the 'w' i need to multiply the other coordinates with.
can someone help me with that? thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您确实出于某种原因想要恢复剪辑空间值,否则不需要计算 W。将 NDC 点乘以投影矩阵的倒数,然后除以 W 以返回视图空间。
Unless you actually want to recover your clip space values for some reason you don't need to calculate the W. Multiply your NDC point by the inverse of the projection matrix and then divide by W to get back to view space.
顶部的流程图以及下页描述的公式可能会对您有所帮助:http:// /www.songho.ca/opengl/gl_transform.html
The flow graph on the top, and the formulas described on the following page, might help you : http://www.songho.ca/opengl/gl_transform.html