铿锵行 发表于 2023-4-11 15:59:18

tex2D与tex2Dproj

最近在看卡通水体渲染,不清楚(https://developer.download.nvidia.cn/cg/tex2Dproj.html)的功能,搜了很多也是让我头晕目眩。

下面是我整理所获与理解,如有纰漏,万望批评指正,指点迷津,不胜感谢~

!(data/attachment/forum/202304/11/154157xaqt9ld7nm93d3z3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

ComputeScreenPos:计算不是物理意义的屏幕空间,是经过MVP矩阵变换到裁剪空间下的屏幕坐标值,还没有进行透视除法。[参考链接](https://blog.csdn.net/linuxheik/article/details/86691117);

_CameraDepthTexture:是在NDC空间下(x,y,z分量[-1,1]^3^的盒子)计算得到的值。

所以说:Performs a texture lookup in sampler samp using coordinates s, the coordinates used in the lookup are first projected, that is, divided by the last component of the coordinate vector and then used in the lookup.先把投影除以w(透视除法)转到到ndc空间下,再进行采样。

它和tex2D的唯一区别就在这里。可以参考[这篇知乎文章](https://zhuanlan.zhihu.com/p/107627483);
页: [1]
查看完整版本: tex2D与tex2Dproj