You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In .NET 9, using Matrix4x4.CreateReflection with a plane where D != 0 no longer gives correct results, specifically in the last column of the matrix (M14, M24, M34, M44).
Yes, the implementation in .NET 8 gave correct results.
Known Workarounds
a. Take the broken result and reset the values in the last column to (0, 0, 0, 1).
b. Copy the previous implementation to a local project and use that instead.
Configuration
.NET 9.0.100
Other information
The implemenation was changed in #103527 for .NET 9
Description
In .NET 9, using Matrix4x4.CreateReflection with a plane where D != 0 no longer gives correct results, specifically in the last column of the matrix (M14, M24, M34, M44).
Reproduction Steps
Expected behavior
{ {M11:1 M12:0 M13:0 M14:0} {M21:0 M22:-1 M23:0 M24:0} {M31:0 M32:0 M33:1 M34:0} {M41:-0 M42:-120 M43:-0 M44:1} }
(net8)
Actual behavior
{ {M11:1 M12:0 M13:0 M14:0} {M21:0 M22:-1 M23:0 M24:-120} {M31:0 M32:0 M33:1 M34:0} {M41:0 M42:-120 M43:0 M44:-7199} }
(net9)
Regression?
Yes, the implementation in .NET 8 gave correct results.
Known Workarounds
a. Take the broken result and reset the values in the last column to (0, 0, 0, 1).
b. Copy the previous implementation to a local project and use that instead.
Configuration
.NET 9.0.100
Other information
The implemenation was changed in #103527 for .NET 9
Before: https://github.com/dotnet/runtime/blame/ab013a35ac6d76320bb6e28a49d62ad82a88e5d6/src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix4x4.Impl.cs#L720
After: https://github.com/dotnet/runtime/blame/3b91ac601980f3cc35e1d8687e7235e874ffc8ea/src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix4x4.Impl.cs#L619
The new implementation accidentally multiples plane.D (W of the vec) by -2 via broadcast whereas the reference implemenation from DirectXMath linked in the code multiplies it by 0
The text was updated successfully, but these errors were encountered: