瀏覽代碼

fixing RT output + adding visual tests 4 / 25

Benjamin Guignabert 4 年之前
父節點
當前提交
7e4b86165a

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

@@ -66,7 +66,7 @@ export class PrePassRenderTarget extends MultiRenderTarget {
     public _checkSize() {
         var	requiredWidth = this._engine.getRenderWidth(true);
         var	requiredHeight = this._engine.getRenderHeight(true);
-        
+
         var width = this.getRenderWidth();
         var height = this.getRenderHeight();
 
@@ -77,7 +77,6 @@ export class PrePassRenderTarget extends MultiRenderTarget {
         }
     }
 
-
     /**
      * Changes the number of render targets in this MRT
      * Be careful as it will recreate all the data in the new texture.
@@ -102,7 +101,7 @@ export class PrePassRenderTarget extends MultiRenderTarget {
     public dispose() {
         super.dispose();
 
-        if (this._scene.prePassRenderer) {
+        if (this._scene && this._scene.prePassRenderer) {
             const index = this._scene.prePassRenderer.renderTargets.indexOf(this);
 
             if (index !== -1) {

+ 10 - 9
src/Rendering/prePassRenderer.ts

@@ -563,19 +563,20 @@ export class PrePassRenderer {
     }
 
     private _linkInternalTexture(prePassRenderTarget: PrePassRenderTarget, postProcess: Nullable<PostProcess>) {
-        if (prePassRenderTarget._internalTextureDirty || prePassRenderTarget._outputPostProcess !== postProcess) {
-            this._updateGeometryBufferLayout();
-            if (postProcess) {
-                postProcess.autoClear = false;
-                postProcess.inputTexture = prePassRenderTarget.getInternalTexture()!;
-            }
+        if (postProcess) {
+            postProcess.autoClear = false;
+            postProcess.inputTexture = prePassRenderTarget.getInternalTexture()!;
+        }
 
-            // Restore previous texture that was forced to the prepass texture
-            if (prePassRenderTarget._outputPostProcess && prePassRenderTarget._outputPostProcess !== postProcess) {
+        if (prePassRenderTarget._outputPostProcess !== postProcess) {
+            if (prePassRenderTarget._outputPostProcess) {
                 prePassRenderTarget._outputPostProcess.restoreDefaultInputTexture();
             }
-
             prePassRenderTarget._outputPostProcess = postProcess;
+        }
+
+        if (prePassRenderTarget._internalTextureDirty) {
+            this._updateGeometryBufferLayout();
             prePassRenderTarget._internalTextureDirty = false;
         }
     }

二進制
tests/validation/ReferenceImages/prepass-ssao-dof.png


二進制
tests/validation/ReferenceImages/prepass-ssao-instanced-bones.png


二進制
tests/validation/ReferenceImages/prepass-ssao-instances.png


二進制
tests/validation/ReferenceImages/prepass-ssao-particles.png


+ 24 - 0
tests/validation/config.json

@@ -973,6 +973,30 @@
             "renderCount": 10,
             "playgroundId": "#MSAHKR#13",
             "referenceImage": "shadowsinstancesright.png"
+        },
+        {
+            "title": "Prepass SSAO + instances",
+            "renderCount": 10,
+            "playgroundId": "#YB006J#349",
+            "referenceImage": "prepass-ssao-instances.png"
+        },
+        {
+            "title": "Prepass SSAO + instanced bones",
+            "renderCount": 10,
+            "playgroundId": "#0K8EYN#194",
+            "referenceImage": "prepass-ssao-instanced-bones.png"
+        },
+        {
+            "title": "Prepass SSAO + particles",
+            "renderCount": 30,
+            "playgroundId": "#65MUMZ#40",
+            "referenceImage": "prepass-ssao-particles.png"
+        },
+        {
+            "title": "Prepass SSAO + depth of field",
+            "renderCount": 10,
+            "playgroundId": "#DX6AV#88",
+            "referenceImage": "prepass-ssao-dof.png"
         }
     ]
 }