Create Fabric

Create Fabric

7M Downloads

Create overrides the content of the projection matrix, causing issues with Iris

coderbot16 opened this issue ยท 3 comments

commented

The Problem

Here is the problematic code in Create: https://github.com/Create-Fabric/Create-Refabricated/blob/d44812db71ac2cf4e385c51135d341b945486547/src/main/java/com/simibubi/create/foundation/render/backend/FastRenderDispatcher.java#L78-L117

There are a few problems here. For one, Iris moves view bobbing and similar effects to the modelview matrix, which means that the projection matrix created by this function will be out of sync with the actual projection matrix in use. But, what that function also does is set the GL projection matrix to the new projection matrix that it computed:

gameRenderer.loadProjectionMatrix(matrix4f);

This means that under Iris, the view bobbing effect is applied twice to any terrain rendered afterwards. Furthermore, this code will cause problems with any mod that modifies the projection matrix for any reason.

The Fix

Here is an example of how the projection matrix can be retrieved directly from the OpenGL state:

https://github.com/CaffeineMC/sodium-fabric/blob/2fb1d28aa61680170e44a138c296f3b5534314e0/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/ChunkProgram.java#L53-L70

This method should work seamlessly with Iris and any other mod that tries to modify the projection matrix.

commented

It seems like this issue was fixed upstream a while ago so I will close this issue. If it happens in the future when the project actually compiles, please open another issue. Thanks.

commented

It's entirely possible that this issue exists in upstream Create as well, so it could be worth fixing it there too.

commented

This is likely an upstream bug, as this issue seems to bring up the same problem. I will let upstream know about this possible fix.