The bug
All textures on blocks' faces handled by the terrain shaders are sampled incorrectly, which leads to obvious interpolated pixel edges. This seems to be the case on all devices and in 25w44a and later.
For example, it doesn't apply to:
Blocks in the GUI
Entities
Block entities
Steps to reproduce
Take a screenshot.
Zoom in to the image using a viewer with no filtering, i.e., with nearest-neighbor scaling.
Look at the edge between texture pixels within any block face, which will be blurry if the bug is present, and make sure to look inside the block face, not on its boundary.
Expected behavior
Performing these steps in versions prior to 25w44a, one would observe no blurred edges.
Additional notes
This issue dates back to 25w44a, which introduced anisotropic filtering. It is present regardless of the mipmap or anisotropic filtering settings. However, it might be related to the fix for MC-300642.
The handling of texelOffset and texelCenter may be problematic. In 25w45a, this alternate implementation of sampleNearest seems to work well at short and long distances but has not been thoroughly tested for potential issues:
vec4 sampleNearest(sampler2D sampler, vec2 uv, vec2 pixelSize) {
// Figure out how big a texel is on the screen, more or less
vec2 du = dFdx(uv);
vec2 dv = dFdy(uv);
// Convert our UV back up to texel coordinates and find out how far over we are from the center of each pixel
vec2 uvTexelCoords = uv / pixelSize;
vec2 texelCenter = round(uvTexelCoords + 0.5f) - 0.5f;
vec2 texelOffset = uvTexelCoords - texelCenter;
// Move our offset closer to the texel center based on texel size on screen
texelOffset = clamp(texelOffset * pixelSize, -abs(du) * 0.5 - abs(dv) * 0.5, abs(du) * 0.5 + abs(dv) * 0.5);
uv = (texelCenter) * pixelSize + texelOffset;
return textureGrad(sampler, uv, du, dv);
}The corresponding changes have also been tested on the latest snapshot and seem to work.
Linked issues
Attachments
Comments 6
The recently linked MC-306718 might have some relation to this issue, but it's important to note that the effect I report is unaffected by mipmap settings (and anisotropic filtering settings). Other more related issues are:
MC-304695 - Here the interpolation is perceived as an intended effect. So the opposite of this issue.
MC-303669 - This may be because of the interpolation/weird pixel placement.
MC-304381 - Very similar issue and looks to be related due to similar interpolation effects.
These images show how alpha gets miscolored by interpolation: The leaves have a black "border", and the grass side (the overlay) has a yellow "border" - possibly the texture under it showing through, like proposed in MC-303669. With "border", I mean miscoloring due to the texture interpolation, as described in this issue.
The first image has no mipmap; the second image has mipmap level 4.
It was hard to preview the images when adding them, so I accidently picked the wrong ones. Here are is non-mipmap image and mipmap level 4 image (zoomed in).
Thank you for helping us improve Minecraft! We saved your files: