Skip to content

Commit

Permalink
postprocessing with reflector performance problem quick hack.
Browse files Browse the repository at this point in the history
  • Loading branch information
gonnavis committed Feb 18, 2021
1 parent a1e8e98 commit 98f9aaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/jsm/objects/ReflectorForSSRPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ var Reflector = function ( geometry, options ) {
this.material = material;

this.onBeforeRender = function ( renderer, scene, camera ) {
if (!window.needReflector) return;
window.needReflector=false
// console.log('onBeforeRender')

reflectorWorldPosition.setFromMatrixPosition( scope.matrixWorld );
cameraWorldPosition.setFromMatrixPosition( camera.matrixWorld );
Expand Down
3 changes: 2 additions & 1 deletion examples/jsm/postprocessing/SSRPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ SSRPass.prototype = Object.assign(Object.create(Pass.prototype), {

if (this.encoding) this.beautyRenderTarget.texture.encoding = this.encoding
renderer.setRenderTarget(this.beautyRenderTarget);
renderer.clear();
renderer.clear();
window.needReflector=true
renderer.render(this.scene, this.camera);

// render normals
Expand Down

0 comments on commit 98f9aaa

Please sign in to comment.