diff --git a/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java b/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java index 863491339c..9ac1d9cf27 100644 --- a/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java +++ b/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java @@ -374,7 +374,7 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame visibleBlockEntities = new ArrayList<>(); // Create our camera - PoseStack modelView = createShadowModelView(this.sunPathRotation, this.intervalSize); + PoseStack modelView = ((NewWorldRenderingPipeline) Iris.getPipelineManager().getPipelineNullable()).shadowModelView; MODELVIEW = new Matrix4f(modelView.last().pose()); levelRenderer.getLevel().getProfiler().push("terrain_setup"); diff --git a/src/main/java/net/coderbot/iris/pipeline/newshader/NewWorldRenderingPipeline.java b/src/main/java/net/coderbot/iris/pipeline/newshader/NewWorldRenderingPipeline.java index 94fd787fc5..21113cec63 100644 --- a/src/main/java/net/coderbot/iris/pipeline/newshader/NewWorldRenderingPipeline.java +++ b/src/main/java/net/coderbot/iris/pipeline/newshader/NewWorldRenderingPipeline.java @@ -957,11 +957,11 @@ Matrix4f GetShadowProjection(Matrix4f shadowModelViewEx) { GetFrustumMinMax(matSceneToShadow, shadowMin, shadowMax); Vector3f shadowSize = shadowMax.sub(shadowMin); - Vector2f center = new Vector2f(shadowSize.x * 0.5f, shadowSize.y * 0.5f); + Vector3f center = new Vector3f((shadowMin.x + shadowMax.x) * 0.5f, (shadowMin.y + shadowMax.y) * 0.5f, (shadowMin.z + shadowMax.z) * 0.5f); center.negate(); float shadowFar = Math.max(Math.abs(shadowMin.z), Math.abs(shadowMax.z)); Matrix4f shadowProjection = new Matrix4f().setOrthoSymmetric(shadowSize.x, shadowSize.y, -200.0f, shadowFar); - Matrix4f shadowOffset = new Matrix4f().setTranslation(new Vector3f(center, 0)); + Matrix4f shadowOffset = new Matrix4f().setTranslation(center); return shadowProjection.mul(shadowOffset); } diff --git a/src/main/java/net/coderbot/iris/uniforms/MatrixUniforms.java b/src/main/java/net/coderbot/iris/uniforms/MatrixUniforms.java index aac10e52af..f06e000e50 100644 --- a/src/main/java/net/coderbot/iris/uniforms/MatrixUniforms.java +++ b/src/main/java/net/coderbot/iris/uniforms/MatrixUniforms.java @@ -23,7 +23,7 @@ public static void addMatrixUniforms(UniformHolder uniforms, PackDirectives dire // We need to audit Mojang's linear algebra. addMatrix(uniforms, "Projection", CapturedRenderingState.INSTANCE::getGbufferProjection); addShadowMatrix(uniforms, "ModelView", () -> - new Matrix4f(ShadowRenderer.createShadowModelView(directives.getSunPathRotation(), directives.getShadowDirectives().getIntervalSize()).last().pose())); + ((NewWorldRenderingPipeline) Iris.getPipelineManager().getPipelineNullable()).shadowModelView.last().pose()); addShadowMatrix(uniforms, "Projection", () -> ((NewWorldRenderingPipeline) Iris.getPipelineManager().getPipelineNullable()).shadowProjection); }