From 47adc1067d6c5fa2e73cee5d94a2a14139d8170c Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Wed, 12 Feb 2025 21:09:11 +0100 Subject: [PATCH] Fix pixel errors at chunk borders. The floating point numbers were rounded differently depending on the chunk. --- assets/cubyz/shaders/chunks/chunk_vertex.vs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/cubyz/shaders/chunks/chunk_vertex.vs b/assets/cubyz/shaders/chunks/chunk_vertex.vs index c1ed110b..09b35b5b 100644 --- a/assets/cubyz/shaders/chunks/chunk_vertex.vs +++ b/assets/cubyz/shaders/chunks/chunk_vertex.vs @@ -68,7 +68,6 @@ void main() { int vertexID = gl_VertexID & 3; int chunkID = gl_BaseInstance; int voxelSize = chunks[chunkID].voxelSize; - vec3 modelPosition = vec3(chunks[chunkID].position.xyz - playerPositionInteger) - playerPositionFraction; int encodedPositionAndLightIndex = faceData[faceID].encodedPositionAndLightIndex; int textureAndQuad = faceData[faceID].textureAndQuad; uint lightIndex = chunks[chunkID].lightStart + 4*(encodedPositionAndLightIndex >> 16); @@ -100,7 +99,8 @@ void main() { position += quads[quadIndex].corners[vertexID]; position *= voxelSize; - position += modelPosition; + position += vec3(chunks[chunkID].position.xyz - playerPositionInteger); + position -= playerPositionFraction; direction = position;