Skip to content

Commit 0a868ea

Browse files
authored
fix SceneOptimizer (#29935)
1 parent 20a5462 commit 0a868ea

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/jsm/utils/SceneOptimizer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class SceneOptimizer {
4646
getMaterialPropertiesHash( material ) {
4747

4848
const mapProps = [
49+
'map',
4950
'alphaMap',
5051
'aoMap',
5152
'bumpMap',
@@ -237,7 +238,15 @@ class SceneOptimizer {
237238
0
238239
);
239240

240-
const batchedMaterial = new THREE.MeshPhysicalMaterial( group.materialProps );
241+
const batchedMaterial = new group.materialProps.constructor( group.materialProps );
242+
243+
if ( batchedMaterial.color !== undefined ) {
244+
245+
// Reset color to white, color will be set per instance
246+
batchedMaterial.color.set( 1, 1, 1 );
247+
248+
}
249+
241250
const batchedMesh = new THREE.BatchedMesh(
242251
maxGeometries,
243252
maxVertices,

0 commit comments

Comments
 (0)