Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-1794

White stitching on polygon edges / White lines or black dots between blocks

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.4.1, Minecraft 1.4.2, Minecraft 1.4.3, Minecraft 1.4.5, Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w02b, Snapshot 13w03a, Snapshot 13w04a, Snapshot 13w05a, Snapshot 13w05b, Snapshot 13w06a, Snapshot 13w07a, Snapshot 13w09a, Snapshot 13w09b, Snapshot 13w09c, Snapshot 13w10a, Snapshot 13w10b, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Minecraft 1.5.2, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 14w11b, Minecraft 1.7.9, Minecraft 14w17a, Minecraft 14w18a, Minecraft 14w29b, Minecraft 14w30a, Minecraft 14w30b, Minecraft 14w31a, Minecraft 14w33a, Minecraft 1.8-pre1, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.8, Minecraft 15w39b, Minecraft 15w44b, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.2, Minecraft 1.9.3 Pre-Release 1, Minecraft 1.9.3 Pre-Release 2, Minecraft 1.9.3 Pre-Release 3, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 16w21a, Minecraft 16w21b, Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 1.10.1, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w42a, Minecraft 16w43a, Minecraft 16w44a, Minecraft 1.11, Minecraft 16w50a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13b, Minecraft 1.12 Pre-Release 6, Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2, Minecraft 17w43b, Minecraft 18w03b, Minecraft 18w06a, Minecraft 18w07a, Minecraft 18w21b, Minecraft 18w22c, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre5, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13, Minecraft 18w30b, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a, Minecraft 19w03a, Minecraft 19w03b, Minecraft 19w03c, Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 2, Minecraft 1.14
    • Fix Version/s: None
    • Environment:

      Windows 7 64Bits

    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      Update: The cracks between 16x16x16 sections have existed for a long time, and still do. Crack theory has been, is, and will still be applicable. The lines that started to appear in between every block in the 1.5 snapshots and should be fixed in 1.5.1 were caused by texture coordinates overflowing their tile slightly in the rasterizer.

      Crack theory

      Cracks occur in rasterizers like OpenGL when edges that should align don't match exactly. This can happen if an inexact calculation is used, and vertices that should be the same end up in slightly different places. The errors may seem minuscule, but they invariably result in severe flickering along the cracks. The rasterizer will miss a few pixels and fill others twice. Using different OpenGL transformations to move different vertices to the same place counts as inexact:

      glRectf(0, 0, 1, 1);
      glRectf(1, 0, 2, 1);
      glRectf(0, 0, 1, 1);
      glTranslatef(0, 0, 1);
      glRectf(0, 0, 1, 1);

      The former will always, unquestionably align. The latter will have a crack. While associativity would tell us that both examples are the same, rounding error does not succumb to associativity. 32-bit floats are exact for integers in [-2^24, 2^24], scaled by a power of two. 64-bit doubles reach a whopping 2^53. If both operands of an addition are round enough (in binary), the result will be exact. This would be typical for code like the first example. Rolling the same addition into a transformation matrix will almost certainly be inexact, because the matrix is polluted by everything else in it. Really the only way to get it right is to perform a separate addition before the matrix.

      If you perform the addition in a vertex shader, keep it separate and it should be okay, save for the hypothetical implementation that optimizes both into a matrix (if they're still technically allowed to optimize willy-nilly nowadays):
      Edit: Uniform state is slow to change, so an attribute used like a uniform would likely be faster than a uniform.

      uniform vec3 translation;
      void main() {
          vec4 vertex = gl_Vertex;
          vertex.xyz += translation;
          gl_Position = gl_ModelViewProjectionMatrix * vertex;
      }

      What's cool about this is that even if you're very far from the world origin, you can still keep everything that matters exact. It also doesn't have a stepping or distortion problem in the Far Lands. The CPU code should do something like this:

      dvec3 camera;
      dvec3 roundedCamera = camera.roundToMultipleOf(16); // Assuming your world transformations are normally a multiple of 16. Can be demoted to float if you stay within 16 * 2^24 blocks. This is half of the magic, by reducing the translation fed into OpenGL to almost nothing.
      dvec3 difference = offset - rounded; // Not critical and rather small; can be demoted to float, and will be when fed to OpenGL.
      // Substitute difference for camera when calculating the camera transformation.

      Then, before drawing each batch:

      dvec3 translationOfBatch; // Can be float if roundedCamera can be.
      dvec3 translation = translationOfBatch - roundedCamera; // This is the other half of the magic. Two potentially huge numbers are reduced to a small, exact multiple of 16. Can certainly be demoted to float, and will be.
      // Load the uniform.

      I hope this is enough theory to help you understand and fix cracks. Now, on to the actual problem description:

      Description

      Previously, cracks would only appear in between 16x16x16 sections. Not as it should be either, but hardly worth reporting. In the latest snapshots, however, they appear in between every single block. That is too much.

      The screenshot shows a superflat world with preset "2;7,62x0,49;2", viewed from below. It should be viewed at its full 1920x1200 size to see the speckles. Incidentally, Minecraft thinks it should light the underside of the obsidian when I get close to it.

      Addendum: textures?

      After noticing the directionality of the cracks, I realized it's crossing over into adjacent tiles on the texture. That could explain some or all of this bug. I will upload a second screenshot demonstrating that. It's of a similar superflat world, but using purple wool (35:10) instead of obsidian.

      What you see is a close-up of the vertex joining four blocks. You can see some yellow seeping through one edge, and blue through the other. Indeed, those are wool blocks adjacent to the right and below, respectively, in stitched_terrain.png generated by an older snapshot. There is also some sky showing through next to the blue wool (I know it's the sky because it becomes black at night). I'd expect it to be orange wool as that is located above it in stitched_terrain.png, but then that file is probably outdated. It may well be that the adjacent texture is transparent. Indeed, green wool doesn't have this 'crack'. Texture coordinates should be the only difference between wool colors, therefore this should be responsible.

      Older versions of Minecraft used to move their texture coordinates inward just a tiny amount to avoid this issue. Was that tweak removed when the rendering engine was overhauled?

        Attachments

        1. 1.4.7.png
          1.4.7.png
          72 kB
        2. 1.4.7 more severe.png
          1.4.7 more severe.png
          292 kB
        3. 14w27b - gaps between blocks.png
          14w27b - gaps between blocks.png
          1.69 MB
        4. 14w29b.png
          14w29b.png
          53 kB
        5. 14w31a black stripes.png
          14w31a black stripes.png
          596 kB
        6. 2013-01-10_15.37.22.png
          2013-01-10_15.37.22.png
          397 kB
        7. 2013-01-15_23.04.49.png
          2013-01-15_23.04.49.png
          327 kB
        8. 2013-01-17_11.51.34.png
          2013-01-17_11.51.34.png
          384 kB
        9. 2013-01-27_17.17.01.png
          2013-01-27_17.17.01.png
          135 kB
        10. 2013-01-28_15.19.37.png
          2013-01-28_15.19.37.png
          1.96 MB
        11. 2013-02-18_18.31.49.png
          2013-02-18_18.31.49.png
          190 kB
        12. 2013-03-03_16.10.04.png
          2013-03-03_16.10.04.png
          521 kB
        13. 2013-03-03_16.16.17.png
          2013-03-03_16.16.17.png
          138 kB
        14. 2013-03-03_16.17.47.png
          2013-03-03_16.17.47.png
          447 kB
        15. 2013-03-06_14.50.13.png
          2013-03-06_14.50.13.png
          195 kB
        16. 2013-03-07_15.56.58 - Lines Thru Blocks Tranceparencey - Zoomed.png
          2013-03-07_15.56.58 - Lines Thru Blocks Tranceparencey - Zoomed.png
          178 kB
        17. 2013-03-07_15.56.58 - Lines Thru Blocks Transpencey.png
          2013-03-07_15.56.58 - Lines Thru Blocks Transpencey.png
          67 kB
        18. 2013-03-15_17.07.57.png
          2013-03-15_17.07.57.png
          258 kB
        19. 2013-03-15_17.13.41.png
          2013-03-15_17.13.41.png
          56 kB
        20. 2013-04-12_13.00.35.png
          2013-04-12_13.00.35.png
          299 kB
        21. 2014-02-04_12.19.26.png
          2014-02-04_12.19.26.png
          259 kB
        22. 2014-02-04_12.22.58.png
          2014-02-04_12.22.58.png
          485 kB
        23. 2014-02-20_14.07.16.png
          2014-02-20_14.07.16.png
          187 kB
        24. 2014-05-01_17.01.17(2).png
          2014-05-01_17.01.17(2).png
          472 kB
        25. 2014-07-27_18.51.47.png
          2014-07-27_18.51.47.png
          1.84 MB
        26. 2014-09-06_18.39.00.png
          2014-09-06_18.39.00.png
          773 kB
        27. 2016-04-27_09.33.59.png
          2016-04-27_09.33.59.png
          473 kB
        28. 2016-12-31_09.48.28.png
          2016-12-31_09.48.28.png
          980 kB
        29. 2016-12-31_09.48.37.png
          2016-12-31_09.48.37.png
          989 kB
        30. 2016-12-31_09.48.42.png
          2016-12-31_09.48.42.png
          1.28 MB
        31. 2017-03-07_12.41.09.png
          2017-03-07_12.41.09.png
          269 kB
        32. 2017-03-07_22.15.34.png
          2017-03-07_22.15.34.png
          382 kB
        33. 2018-08-08_16.26.51.png
          2018-08-08_16.26.51.png
          2.29 MB
        34. clouds-1.9.1pre3.png
          clouds-1.9.1pre3.png
          6.38 MB
        35. dark cave.jpg
          dark cave.jpg
          83 kB
        36. gap.jpg
          gap.jpg
          86 kB
        37. Huge gaps edge-on.png
          Huge gaps edge-on.png
          497 kB
        38. MC1_14Bug.jpg
          MC1_14Bug.jpg
          3.00 MB
        39. MC-1794.gif
          MC-1794.gif
          4.40 MB
        40. minecraft 1.5.jpg
          minecraft 1.5.jpg
          155 kB
        41. newsnap.png
          newsnap.png
          67 kB
        42. newsnap2.png
          newsnap2.png
          63 kB
        43. RST (2).zip
          189 kB
        44. slanting.png
          slanting.png
          382 kB
        45. Stitching.jpg
          Stitching.jpg
          274 kB
        46. White wool black points (1.8.3).png
          White wool black points (1.8.3).png
          368 kB
        47. White wool texture mistakes distance (1.8.3).png
          White wool texture mistakes distance (1.8.3).png
          451 kB

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jonathan2520 jonathan2520
              • Votes:
                361 Vote for this issue
                Watchers:
                60 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: