Skip to content

Commit

Permalink
fix: solve postproduction custom pass quality degradation when resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Jun 20, 2024
1 parent a70747c commit 2506de6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/front/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components-front",
"description": "Collection of frontend tools to author BIM apps.",
"version": "2.0.13",
"version": "2.0.14",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export class CustomEffectsPass extends Pass {
this.outlineBuffer.dispose();
this.normalOverrideMaterial.dispose();
this.glossOverrideMaterial.dispose();
this.fsQuad.material.dispose();
this.fsQuad.dispose();

this.excludedMeshes = [];
Expand Down Expand Up @@ -198,6 +199,7 @@ export class CustomEffectsPass extends Pass {
1 / this.resolution.x,
1 / this.resolution.y,
);
material.uniformsNeedUpdate = true;
}

render(renderer: THREE.WebGLRenderer, writeBuffer: any, readBuffer: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,21 @@ export class Postproduction {
*/
setSize(width: number, height: number) {
if (this._initialized) {
const customEnabled = this._settings.custom;
if (customEnabled) {
// For some reason, the custom pass quality degrades if it's resized while being active
// Maybe we should investigate this at some point
this.setPasses({ custom: false });
}
this.setPasses({ custom: false });
this.composer.setSize(width, height);
this.basePass.setSize(width, height);
this.n8ao.setSize(width, height);
this.customEffects.setSize(width, height);
this.gammaPass.setSize(width, height);
if (customEnabled) {
this.setPasses({ custom: true });
}
}
}

Expand Down

0 comments on commit 2506de6

Please sign in to comment.