[Shaders] looking perfrectly north doesn't update the gbufferModelView matrix
Description of Issue
looking perfectly north doesn't update the gbufferModelView matrix, and it stays on the value from the previous direction, untill looking away from north
Steps to Reproduce
- use the command
/tp @p ~ ~ ~ 180 0to look perfectly north - see that stuff goes wrong, easiest to see is that shadows are wrong in most shaders
OptiFine Version
1.20.6_HD_U_I9_pre1
Installation Method
standalone installer
F3 Debug Screenshot
Additional Information
digging through the optifine code, this seems to be cause by a combination of two things:
- in
net.optifine.shaders.Shaders#setModelView(Matrix4f matrixIn)the new matrix is checked to not be the same aslastModelViewbefore being set lastModelViewgets reset to identity every frame though innet.optifine.shaders.Shaders#beginRender
so when looking prefectly north, the modelview matrix is an identity matrix, which equals the lastModelView there and it doesn't get set
I cannot see it in my game. Have you changed some option of Optifine?
Oh wait it suddenly happened, that's strange.
There must be some trigger, as it can appear suddenly and disappear too. Possible trigger might be gbufferModelView[1].w, as I found when it's positive (not really positive, it's +0.0 at that time) this bug will appear, but when it's negative (and -0.0), it won't appear.
When player first enter a world, gbufferModelView[1].w is +0.0, so the bug will happen, until the player walking on ground with view bobbing on, gbufferModelView[1].w will always be negative (including -0), prevent this bug from happen, unless the player is moving while falling, this is the only way I found can make gbufferModelView[1].w become +0.0 again.
This bug won't even happen when view bobbing is off, and when it happen, disable view bobbing will making it looks correct again.