且构网

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

如何消除金属中的模糊纹理?

更新时间:2023-11-10 13:49:10

在纹理样本调用中(在着色器中),您需要将放大滤镜设置为最近",而不是线性",就像这样(假设您的采样器在着色器中被声明为内联):

In your texture sample call (in the shader), you need to set your magnification filter to 'nearest', instead of 'linear', like so (assuming your sampler is declared inline inside your shader):

constexpr sampler textureSampler (mag_filter::nearest, // <-- Set this to 'nearest' if you don't want any filtering on magnification
                                  min_filter::nearest);

// Sample the texture to obtain a color
const half4 colorSample = colorTexture.sample(textureSampler, in.textureCoordinate);