Skip to content

Commit

Permalink
fix SceneOptimizer (#29935)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlaricBaraou authored Nov 20, 2024
1 parent 20a5462 commit 0a868ea
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/jsm/utils/SceneOptimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SceneOptimizer {
getMaterialPropertiesHash( material ) {

const mapProps = [
'map',
'alphaMap',
'aoMap',
'bumpMap',
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0a868ea

Please sign in to comment.