CaffeineMC/sodium-fabric

Fix weird vanilla shading for rotated model elements

muzikbike opened this issue · 1 comments

Request Description

May be related to #461 and/or fixable alongside it; like most of my recent reports, this is a vanilla bug that I'm curious if Sodium can fix.

For rotated elements in models, it's possible for two differently-defined planes or cuboids that should mathematically evaluate to the same thing to end up having completely different shading calculations. For example, a south-facing plane rotated 45 degrees clockwise would be shaded very differently from a west-facing plane rotated 45 degrees anticlockwise.

The resource pack attached to https://bugs.mojang.com/browse/MC-262644 makes this easy to see - the three types of torches are remodeled so that normal torches are composed of two yz planes rotated -45 degrees, soul torches are composed of two xy planes rotated +45 degrees, and redstone torches are composed of one of each type of plane. The brightness difference is very clearly visible, with redstone torches containing both in the same block space.

2024-05-10_22 48 41

It's probably possible to fix this in a way that only affects shaded, rotated block planes, which comprise only a minority of vanilla block models. I don't know if it would be preferable to leave this alone in the interests of not affecting resource packs and modded block models, but as a resource pack creator myself this does annoy me fairly often.

The Fabric Rendering API also has to try and prevent this issue for custom model geometry. Probably the resolution to this issue will be us just enforcing whatever it is already doing.