更新时间:2023-11-08 12:53:58
这是纹理采样器的正确行为。
This is correct behavior of texture sampler.
让我解释一下。使用 GL_LINEAR
采样的纹理时,GPU将采用与附近像素混合的像素的平均颜色(这就是为什么你没有像 GL_NEAREST那样看到像素化的原因
模式 - 像素模糊不清)。
和 GL_REPEAT
模式纹理坐标将从0换算为1,反之亦然,与附近的像素混合(即在极坐标中,它将与纹理的另一面混合)。 GL_CLAMP_TO_EDGE
可防止此包装行为,并且像素不会与纹理对面的像素混合。
Let me explain this. When you use textures with GL_LINEAR
sampling GPU will take an average color of pixel blended with nearby pixels (that's why you don't see pixelation as with GL_NEAREST
mode - pixels are blurred instead).
And with GL_REPEAT
mode texture coordinates will wrap from 0 to 1 and vice versa, blending with nearby pixels (i.e. in extreme coordinates it will blend with opposite side of texture). GL_CLAMP_TO_EDGE
prevents this wrapping behavior, and pixels won't blend with pixels from opposite side of texture.
希望我的解释清楚。