From 9c46c8cc6c39fbd1c9dbe57f174625ca38a0f27a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 1 Feb 2026 16:00:14 -0800 Subject: [PATCH] Use MeshLambertMaterial for original game-like rendering Switch from MeshStandardMaterial (PBR) to MeshLambertMaterial for flat, vibrant colors matching the original game. Simplify lighting setup for solid colors without visible shadows. --- src/core/rendering/VehiclePartRenderer.js | 28 ++++++----------------- src/core/rendering/WdbModelRenderer.js | 23 +++++++------------ 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/src/core/rendering/VehiclePartRenderer.js b/src/core/rendering/VehiclePartRenderer.js index 607d908..477f81f 100644 --- a/src/core/rendering/VehiclePartRenderer.js +++ b/src/core/rendering/VehiclePartRenderer.js @@ -32,20 +32,12 @@ export class VehiclePartRenderer { } setupLighting() { - const ambient = new THREE.AmbientLight(0xffffff, 0.6); + const ambient = new THREE.AmbientLight(0xffffff, 0.8); this.scene.add(ambient); - const keyLight = new THREE.DirectionalLight(0xffffff, 0.8); - keyLight.position.set(2, 2, 3); - this.scene.add(keyLight); - - const fillLight = new THREE.DirectionalLight(0xffffff, 0.4); - fillLight.position.set(-2, 1, 2); - this.scene.add(fillLight); - - const rimLight = new THREE.DirectionalLight(0xffffff, 0.3); - rimLight.position.set(0, 1, -3); - this.scene.add(rimLight); + const sunLight = new THREE.DirectionalLight(0xffffff, 0.6); + sunLight.position.set(1, 2, 3); + this.scene.add(sunLight); } /** @@ -145,11 +137,9 @@ export class VehiclePartRenderer { if (isColorable) { // Mesh has INH prefix - use the LEGO color - material = new THREE.MeshStandardMaterial({ + material = new THREE.MeshLambertMaterial({ color: legoColor, side: THREE.DoubleSide, - roughness: 0.7, - metalness: 0.1, transparent: isTransparent, opacity: opacity, depthWrite: !isTransparent @@ -157,11 +147,9 @@ export class VehiclePartRenderer { this.colorableMeshes.push(null); // Placeholder, will set after mesh creation } else if (hasUVs && meshTextureName && this.textures.has(meshTextureName)) { // Mesh has its own texture - material = new THREE.MeshStandardMaterial({ + material = new THREE.MeshLambertMaterial({ map: this.textures.get(meshTextureName), side: THREE.DoubleSide, - roughness: 0.8, - metalness: 0.1, transparent: isTransparent, opacity: opacity, depthWrite: !isTransparent @@ -169,11 +157,9 @@ export class VehiclePartRenderer { } else { // Fallback to mesh's vertex color const meshColor = mesh.properties?.color || { r: 128, g: 128, b: 128 }; - material = new THREE.MeshStandardMaterial({ + material = new THREE.MeshLambertMaterial({ color: new THREE.Color(meshColor.r / 255, meshColor.g / 255, meshColor.b / 255), side: THREE.DoubleSide, - roughness: 0.8, - metalness: 0.1, transparent: isTransparent, opacity: opacity, depthWrite: !isTransparent diff --git a/src/core/rendering/WdbModelRenderer.js b/src/core/rendering/WdbModelRenderer.js index 675e3f6..26f47c9 100644 --- a/src/core/rendering/WdbModelRenderer.js +++ b/src/core/rendering/WdbModelRenderer.js @@ -35,14 +35,12 @@ export class WdbModelRenderer { * Setup scene lighting - override to customize */ setupLighting() { - // Flat, even lighting similar to in-game - const ambient = new THREE.AmbientLight(0xffffff, 1.5); + const ambient = new THREE.AmbientLight(0xffffff, 0.8); this.scene.add(ambient); - // Soft front light - const frontLight = new THREE.DirectionalLight(0xffffff, 0.3); - frontLight.position.set(0, 0, 5); - this.scene.add(frontLight); + const sunLight = new THREE.DirectionalLight(0xffffff, 0.6); + sunLight.position.set(1, 2, 3); + this.scene.add(sunLight); } /** @@ -62,22 +60,18 @@ export class WdbModelRenderer { this.texture.magFilter = THREE.LinearFilter; if (texturedGeometry) { - const texturedMaterial = new THREE.MeshStandardMaterial({ + const texturedMaterial = new THREE.MeshLambertMaterial({ map: this.texture, - side: THREE.DoubleSide, - roughness: 0.8, - metalness: 0.1 + side: THREE.DoubleSide }); this.texturedMesh = new THREE.Mesh(texturedGeometry, texturedMaterial); this.modelGroup.add(this.texturedMesh); } for (const { geometry, color } of nonTexturedGeometries) { - const material = new THREE.MeshStandardMaterial({ + const material = new THREE.MeshLambertMaterial({ color: new THREE.Color(color.r / 255, color.g / 255, color.b / 255), - side: THREE.DoubleSide, - roughness: 0.8, - metalness: 0.1 + side: THREE.DoubleSide }); const mesh = new THREE.Mesh(geometry, material); this.modelGroup.add(mesh); @@ -126,7 +120,6 @@ export class WdbModelRenderer { } } - // Build mesh vertices following brickolini-island logic const meshVertices = []; const meshNormals = []; const meshUvs = [];