且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在像素着色器中计算世界空间坐标

更新时间:2022-04-07 22:24:21

如果我没记错的话,SV_POSITION仅是0-> W 0-> H,因此它描述了它在屏幕上的位置.该站点包含更多信息: http: //msdn.microsoft.com/zh-CN/library/windows/desktop/bb509647(v=vs.85).aspx

If i remember this correctly, SV_POSITION is only 0->W 0->H, so it describes where it is on the screen. this site contains more information : http://msdn.microsoft.com/en-us/library/windows/desktop/bb509647(v=vs.85).aspx

要使像素进入世界空间,请将像素坐标转换回世界空间.数学和所有数学都有些棘手(我想是!) 但是这篇文章应该可以帮到您! http://jcoluna.wordpress.com/2011/01/27/reconstructing-view-space-position-from-depth/

To get the pixel to world space, you transform your pixelcordinate back to worlspace. it´s a bit tricky with the math and all ( i think it is! ) but this article should help you out! http://jcoluna.wordpress.com/2011/01/27/reconstructing-view-space-position-from-depth/

否则,明智地搜索像素到视域.我知道您想要世界空间,但将所有内容转换为视图空间可能更快.

else wise search for pixel to viewspace. i know you wanted worldspace, but converting everything to viewspace is probably faster.