From 88622cb5c118bb73a30da4716f8e4f8c677622a7 Mon Sep 17 00:00:00 2001 From: makamys Date: Thu, 30 Jun 2022 12:11:16 +0200 Subject: Clean up vertex shader --- src/main/resources/shaders/chunk.vert | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/resources/shaders/chunk.vert b/src/main/resources/shaders/chunk.vert index b0d9177..823b546 100644 --- a/src/main/resources/shaders/chunk.vert +++ b/src/main/resources/shaders/chunk.vert @@ -47,8 +47,9 @@ void main() float s = fogStartEnd.x; float e = fogStartEnd.y; vec4 eyePos = (modelView * (vec4(aPos - playerPos, 1.0) + vec4(0, 0.12, 0, 0))); + float c = length(eyePos); - float fogFactor = clamp((e - length(eyePos)) / (e - s), 0, 1); + float fogFactor = clamp((e - c) / (e - s), 0, 1); FogFactor = fogFactor; } else { -- cgit