optifine icon indicating copy to clipboard operation
optifine copied to clipboard

[Shaders] looking perfrectly north doesn't update the gbufferModelView matrix

Open fayer3 opened this issue 1 year ago • 3 comments

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

  1. use the command /tp @p ~ ~ ~ 180 0 to look perfectly north
  2. 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

grafik

Additional Information

digging through the optifine code, this seems to be cause by a combination of two things:

  1. in net.optifine.shaders.Shaders#setModelView(Matrix4f matrixIn) the new matrix is checked to not be the same as lastModelView before being set
  2. lastModelView gets reset to identity every frame though in net.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

fayer3 avatar Aug 09 '24 22:08 fayer3

I cannot see it in my game. Have you changed some option of Optifine? 2024-08-10_10 40 54

GeForceLegend avatar Aug 10 '24 02:08 GeForceLegend

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.

GeForceLegend avatar Aug 10 '24 02:08 GeForceLegend

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.

GeForceLegend avatar Aug 10 '24 03:08 GeForceLegend