Benjamin Guignabert 4 лет назад
Родитель
Сommit
a6d96863ca
2 измененных файлов с 5 добавлено и 2 удалено
  1. 0 2
      src/Materials/Textures/prePassRenderTarget.ts
  2. 5 0
      src/Rendering/prePassRenderer.ts

+ 0 - 2
src/Materials/Textures/prePassRenderTarget.ts

@@ -57,9 +57,7 @@ export class PrePassRenderTarget extends MultiRenderTarget {
     }
 
     public _createCompositionEffect() {
-        const applyByPostProcess = this._scene.imageProcessingConfiguration?.applyByPostProcess;
         this.imageProcessingPostProcess = new ImageProcessingPostProcess("prePassComposition", 1, null, undefined, this._engine);
-        this.imageProcessingPostProcess.imageProcessingConfiguration.applyByPostProcess = applyByPostProcess;
     }
 
     /**

+ 5 - 0
src/Rendering/prePassRenderer.ts

@@ -643,6 +643,7 @@ export class PrePassRenderer {
     private _update() {
         this._disable();
         let enablePrePass = false;
+        this._scene.imageProcessingConfiguration.applyByPostProcess = false;
 
         for (let i = 0; i < this._scene.materials.length; i++) {
             if (this._scene.materials[i].setPrePassRenderer(this)) {
@@ -684,6 +685,10 @@ export class PrePassRenderer {
                         enablePrePass = true;
                     }
                 }
+
+                if (this._hasImageProcessing(postProcesses)) {
+                    this._scene.imageProcessingConfiguration.applyByPostProcess = true;
+                }
             }
         }