Normal matrix scaling broken in some situations
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)).
2021-05-08, 08:14 AM
2024-02-03, 02:05 PM
2024-01-25, 04:02 PM
18
6
1.16.5 - 23w07a
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