Skip to content

Commit

Permalink
Update materialProperties.environment even if program doesn't change
Browse files Browse the repository at this point in the history
The environment map can be switched to a different image while still using the exact same shader. It's important to update materialProperties.environment in this case so that unnecessary calls to initMaterial can be avoided. Prior to this fix FPS could be halved after changing scene.environment.
  • Loading branch information
Oletus committed Apr 3, 2020
1 parent 2288ef1 commit 677e44e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1519,12 +1519,13 @@ function WebGLRenderer( parameters ) {

materialProperties.program = program;
materialProperties.uniforms = parameters.uniforms;
materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
materialProperties.outputEncoding = _this.outputEncoding;
material.program = program;

}

materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;

var programAttributes = program.getAttributes();

if ( material.morphTargets ) {
Expand Down

0 comments on commit 677e44e

Please sign in to comment.