From 0a868eab9a6d6be330cdbb1a5f18c0d99c7c7ccb Mon Sep 17 00:00:00 2001 From: "Alaric.Baraou" Date: Wed, 20 Nov 2024 21:26:05 +0900 Subject: [PATCH] fix SceneOptimizer (#29935) --- examples/jsm/utils/SceneOptimizer.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/jsm/utils/SceneOptimizer.js b/examples/jsm/utils/SceneOptimizer.js index 14e56c35a78977..84c4854c8ce84f 100644 --- a/examples/jsm/utils/SceneOptimizer.js +++ b/examples/jsm/utils/SceneOptimizer.js @@ -46,6 +46,7 @@ class SceneOptimizer { getMaterialPropertiesHash( material ) { const mapProps = [ + 'map', 'alphaMap', 'aoMap', 'bumpMap', @@ -237,7 +238,15 @@ class SceneOptimizer { 0 ); - const batchedMaterial = new THREE.MeshPhysicalMaterial( group.materialProps ); + const batchedMaterial = new group.materialProps.constructor( group.materialProps ); + + if ( batchedMaterial.color !== undefined ) { + + // Reset color to white, color will be set per instance + batchedMaterial.color.set( 1, 1, 1 ); + + } + const batchedMesh = new THREE.BatchedMesh( maxGeometries, maxVertices,