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

Normal matrix scaling broken in some situations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w05a
    • 1.16.5, 1.17 Pre-release 3, 1.17 Pre-release 4, 1.17 Pre-release 5, 1.17 Release Candidate 1, 1.17, 1.17.1 Pre-release 1, 1.17.1 Release Candidate 1, 1.17.1, 21w42a, 21w44a, 1.18 Pre-release 4, 1.18.1, 1.18.2, 22w16a, 22w16b, 1.19 Pre-release 3, 1.19 Release Candidate 1, 1.19 Release Candidate 2, 1.19, 1.19.2, 1.19.3, 23w07a
    • Plausible
    • Rendering
    • Low
    • Platform

      The method com/mojang/blaze3d/vertex/PoseStack#scale is broken in some situations:

      1. If one or three of the scales are negative, the normal matrix will not be scaled correctly. The fix for this is to take the absolute value (Math.abs) of the argument passed into the net/minecraft/util/Mth#fastInvCubeRoot method. Additionally, net/minecraft/util/Mth#fastInvCubeRoot does not work for negative numbers, but fixing it does not solve this issue because it causes the matrix to be inverted.

      2. If all scales are equal and negative, the normal matrix will not be scaled correctly. For this case, all normals should be inverted, but in reality nothing happens. The fix for this is to return after the normal matrix is inverted (normal.mul(-1.0f)).

            gegy1000 [Mojang] Gegy
            Pepper_Bell Pepper Bell
            Votes:
            18 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: