2 Commits

Author SHA1 Message Date
Tom Boullay 68253fae41 Update lightingConfig.ts
🔍 Lint / 🪄 Check lint (push) Has been cancelled
🔍 Lint / 🎨 Check format (push) Has been cancelled
🔍 Lint / 🔎 Typecheck (push) Has been cancelled
📊 Quality / 🔒 Security Audit (push) Has been cancelled
📊 Quality / 📋 Dependency Freshness (push) Has been cancelled
📊 Quality / 📦 Bundle Size (push) Has been cancelled
🔍 Lint / 🏗 Build (push) Has been cancelled
2026-06-02 14:52:54 +02:00
Tom Boullay 2dabb73d3d fix(vegetation): scale-correct sapin and buisson LOD meshes
The exported sapin-LOD and buisson-LOD models do not match their full
detail counterpart's baseline scale, so they appear oversized once the
LOD swap kicks in. Add MAP_LOD_SCALE_MULTIPLIERS keyed by map name
(sapin: 0.5, buisson: 0.8) and apply it on top of the chunk's existing
scaleMultiplier whenever the resolved model path is the LOD variant.
2026-06-02 14:50:07 +02:00
3 changed files with 27 additions and 4 deletions
+2 -2
View File
@@ -3,9 +3,9 @@ const SUN_LIGHT_COLOR = "#ffe2bf";
export const LIGHTING_DEFAULTS = {
ambientColor: AMBIENT_LIGHT_COLOR,
ambientIntensity: 0.9,
ambientIntensity: 0.7,
sunColor: SUN_LIGHT_COLOR,
sunIntensity: 2.2,
sunIntensity: 1.9,
sunX: 70,
sunY: 45,
sunZ: 35,
+14
View File
@@ -25,6 +25,20 @@ export function getMapLodModelPath(modelName: string): string | null {
);
}
export const MAP_LOD_SCALE_MULTIPLIERS = {
sapin: 0.35,
buisson: 0.7,
} as const satisfies Partial<Record<keyof typeof MAP_LOD_MODEL_PATHS, number>>;
export function getMapLodScaleMultiplier(modelName: string): number {
return (
MAP_LOD_SCALE_MULTIPLIERS[
modelName as keyof typeof MAP_LOD_SCALE_MULTIPLIERS
] ?? 1
);
}
export function selectMapModelPathByDistance({
distance,
modelName,
+11 -2
View File
@@ -8,7 +8,11 @@ import {
} from "react";
import { useFrame, useThree } from "@react-three/fiber";
import { CHUNK_CONFIG } from "@/data/world/chunkStreamingConfig";
import { selectMapModelPathByDistance } from "@/data/world/mapLodConfig";
import {
getMapLodModelPath,
getMapLodScaleMultiplier,
selectMapModelPathByDistance,
} from "@/data/world/mapLodConfig";
import { useCameraMode } from "@/hooks/debug/useCameraMode";
import { useSceneMode } from "@/hooks/debug/useSceneMode";
import {
@@ -205,12 +209,17 @@ export function VegetationSystem({
<group name="vegetation-system">
{visibleChunks.map((chunk) => {
const modelPath = chunkModelPaths.get(chunk.key) ?? chunk.modelPath;
const mapName = VEGETATION_TYPES[chunk.type].mapName;
const isLod = modelPath === getMapLodModelPath(mapName);
const scaleMultiplier =
chunk.scaleMultiplier *
(isLod ? getMapLodScaleMultiplier(mapName) : 1);
return (
<Suspense key={`${chunk.key}:${modelPath}`} fallback={null}>
<InstancedVegetation
modelPath={modelPath}
instances={chunk.instances}
scaleMultiplier={chunk.scaleMultiplier}
scaleMultiplier={scaleMultiplier}
castShadow={chunk.castShadow}
receiveShadow={chunk.receiveShadow}
windStrength={chunk.windStrength}