From 4f1b3b4ff36b5ec8b286cd7d86c082f50f0eed79 Mon Sep 17 00:00:00 2001 From: Tom Boullay Date: Tue, 2 Jun 2026 14:33:16 +0200 Subject: [PATCH] fix(graphics): tune presets, single-line ui, vegetation LOD by nearest instance - Bump high to 30m chunk / HD<20m and ultra to HD<30m so HD models persist further before swapping. - Render the 5 graphics preset cards on a single row. - Vegetation LOD selection now uses the distance to the nearest instance in each chunk instead of the chunk centre, matching MapInstancingSystem and avoiding premature LOD swaps when the camera enters a chunk. --- src/data/world/graphicsConfig.ts | 8 ++++---- src/index.css | 2 +- src/world/vegetation/VegetationSystem.tsx | 15 ++++++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/data/world/graphicsConfig.ts b/src/data/world/graphicsConfig.ts index 441a2ef..43dbd19 100644 --- a/src/data/world/graphicsConfig.ts +++ b/src/data/world/graphicsConfig.ts @@ -39,12 +39,12 @@ export const GRAPHICS_PRESETS = { }, high: { label: "High", - chunkLoadRadius: 35, - chunkUnloadRadius: 45, + chunkLoadRadius: 30, + chunkUnloadRadius: 40, chunkStreamingEnabled: true, fogEnabled: false, forceLodModels: false, - lodHighDetailDistance: 10, + lodHighDetailDistance: 20, }, ultra: { label: "Ultra", @@ -53,7 +53,7 @@ export const GRAPHICS_PRESETS = { chunkStreamingEnabled: true, fogEnabled: false, forceLodModels: false, - lodHighDetailDistance: 20, + lodHighDetailDistance: 30, }, max: { label: "Max", diff --git a/src/index.css b/src/index.css index 0eb57e5..5a47469 100644 --- a/src/index.css +++ b/src/index.css @@ -1544,7 +1544,7 @@ canvas { } .game-settings-menu__choice-group--presets { - grid-template-columns: repeat(4, minmax(0, 1fr)); + grid-template-columns: repeat(5, minmax(0, 1fr)); } .game-settings-menu__choice-group button, diff --git a/src/world/vegetation/VegetationSystem.tsx b/src/world/vegetation/VegetationSystem.tsx index 002e0f2..00c9b37 100644 --- a/src/world/vegetation/VegetationSystem.tsx +++ b/src/world/vegetation/VegetationSystem.tsx @@ -109,12 +109,17 @@ function useVegetationChunkModelPaths( const next = new Map(); for (const chunk of chunks) { - const distance = Math.hypot( - chunk.centerX - cameraX, - chunk.centerZ - cameraZ, - ); + let nearestDistance = Number.POSITIVE_INFINITY; + for (const instance of chunk.instances) { + const distance = Math.hypot( + instance.position[0] - cameraX, + instance.position[2] - cameraZ, + ); + if (distance < nearestDistance) nearestDistance = distance; + } + const modelPath = selectMapModelPathByDistance({ - distance, + distance: nearestDistance, modelName: VEGETATION_TYPES[chunk.type].mapName, modelPath: chunk.modelPath, preset,