MaxTextureRepeat 限制在什么时候开始发挥作用?

发布于 2024-07-08 05:52:57 字数 187 浏览 3 评论 0原文

在 Direct3D 下执行像素着色器时,MaxTextureRepeat 对纹理坐标施加的限制是否仅在调用纹理查找函数(例如 Tex2D())期间成为问题,还是在着色器内访问纹理坐标时它们会发挥作用?

我想知道是否可以通过在将纹理坐标传递给纹理查找函数之前调用类似 frac() 之类的方法来避免 MaxTextureRepeat 限制。

When executing a pixel shader under Direct3D, do the limits on texture coordinates imposed by MaxTextureRepeat only become an issue during calls to texture lookup functions such as Tex2D(), or do they come into play anytime the texture coordinates are accessed within the shader?

I wish to know whether it's possible to avoid the MaxTextureRepeat limitation by calling something like frac() on the texture coordinates before passing them on to the texture lookup function.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不知在何时 2024-07-15 05:52:57

纹理坐标采用本机插值器精度。 在支持像素着色器 2.0 的硬件上,这至少是 24 位浮点(或者可能是 32 位,不确定)。 在像素着色器内部,计算必须至少为 24 位浮点。 大多数现代 GPU 以 32 位浮点精度运行。

MaxTextureRepeat 是纹理采样硬件的功能。

所以,是的,如果您没有遇到浮点精度限制,那么在采样之前限制范围是避免纹理重复限制的一种方法。

然而,当 frac 从 0 变为 1 时,您将获得较大的梯度,因此在这些地方 GPU 将希望使用非常低分辨率的 mip 级别。 当然,这可能不是问题,具体取决于您的情况; 但这是潜在问题的一点。

Texture coordinates are at native interpolator precision. On pixel shader 2.0 capable hardware, this is at least 24 bits floating point (or perhaps 32 bits, not sure). Internally the calculations in pixel shader must be at least 24 bits floating point. Most modern GPUs run at 32 bits floating point precision.

The MaxTextureRepeat is the capability of the texture sampling hardware.

So, yes, if you don't run into floating point precision limitations, then limiting the range before sampling is one way to avoid the texture repeat limits.

However, where frac turns from 0 to 1 you'll get large gradients, so at those places the GPU will want to use very low resolution mip level. This can be not a problem depending on your situation of course; but it's one point of potential problem(s).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文