The bug
During the sniffer's sniffing animation, its snout inflates. However, the shading of it also changes, creating a clear line in its geometry and breaking the illusion. The snout may appear brighter or darker depending on the direction the sniffer is facing.
Code analysis
Code analysis by @unknown can be found in this comment.
I was able to create a Fabric mod that fixes this issue by changing Minecraft's code. Hopefully the way I resolved this issue and the following insights will be useful.
The issue was mostly fixed after the following change in
com.mojang.blaze3d.vertex.PoseStack
.However, after this change, the top of nose got darker the more the nose was scaled up. This is because Minecraft does not normalize the normal vector after it is transformed by the normal matrix. When the fragment shader uses the vertex normal vector to calculate lighting, it is not unit length, which results in dark lighting. Normalizing the vector after it is transformed in
net.minecraft.client.model.geom.ModelPart$Cube#compile
fixes this issue, and thus completely resolves the initial issue.