Przeglądaj źródła

adding tests 21/25

Benjamin Guignabert 4 lat temu
rodzic
commit
ec759e8b03

+ 1 - 1
src/Rendering/prePassRenderer.ts

@@ -141,7 +141,7 @@ export class PrePassRenderer {
     /**
      * Prevents the PrePassRenderer from using the GeometryBufferRenderer as a fallback
      */
-    public doNotUseGeometryRendererFallback = false;
+    public doNotUseGeometryRendererFallback = true;
 
     private _refreshGeometryBufferRendererLink() {
         if (!this.doNotUseGeometryRendererFallback) {

+ 10 - 8
src/Shaders/default.fragment.fx

@@ -477,10 +477,12 @@ color.rgb = max(color.rgb, 0.);
 
 #define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
 #ifdef PREPASS
+	float writeGeometryInfo = color.a > 0.4 ? 1.0 : 0.0;
+
     gl_FragData[0] = color; // We can't split irradiance on std material
     
     #ifdef PREPASS_POSITION
-    gl_FragData[PREPASS_POSITION_INDEX] = vec4(vPositionW, 1.0);
+    gl_FragData[PREPASS_POSITION_INDEX] = vec4(vPositionW, writeGeometryInfo);
     #endif
 
     #ifdef PREPASS_VELOCITY
@@ -490,29 +492,29 @@ color.rgb = max(color.rgb, 0.);
     vec2 velocity = abs(a - b);
     velocity = vec2(pow(velocity.x, 1.0 / 3.0), pow(velocity.y, 1.0 / 3.0)) * sign(a - b) * 0.5 + 0.5;
 
-    gl_FragData[PREPASS_VELOCITY_INDEX] = vec4(velocity, 0.0, 1.0);
+    gl_FragData[PREPASS_VELOCITY_INDEX] = vec4(velocity, 0.0, writeGeometryInfo);
     #endif
 
     #ifdef PREPASS_IRRADIANCE
-        gl_FragData[PREPASS_IRRADIANCE_INDEX] = vec4(0.0, 0.0, 0.0, 1.0); //  We can't split irradiance on std material
+        gl_FragData[PREPASS_IRRADIANCE_INDEX] = vec4(0.0, 0.0, 0.0, writeGeometryInfo); //  We can't split irradiance on std material
     #endif
 
     #ifdef PREPASS_DEPTH
-        gl_FragData[PREPASS_DEPTH_INDEX] = vec4(vViewPos.z, 0.0, 0.0, 1.0); // Linear depth
+        gl_FragData[PREPASS_DEPTH_INDEX] = vec4(vViewPos.z, 0.0, 0.0, writeGeometryInfo); // Linear depth
     #endif
 
     #ifdef PREPASS_NORMAL
-        gl_FragData[PREPASS_NORMAL_INDEX] = vec4((view * vec4(normalW, 0.0)).rgb, 1.0); // Normal
+        gl_FragData[PREPASS_NORMAL_INDEX] = vec4((view * vec4(normalW, 0.0)).rgb, writeGeometryInfo); // Normal
     #endif
 
     #ifdef PREPASS_ALBEDO
-        gl_FragData[PREPASS_ALBEDO_INDEX] = vec4(0.0, 0.0, 0.0, 1.0); // We can't split albedo on std material
+        gl_FragData[PREPASS_ALBEDO_INDEX] = vec4(0.0, 0.0, 0.0, writeGeometryInfo); // We can't split albedo on std material
     #endif
     #ifdef PREPASS_REFLECTIVITY
         #if defined(SPECULAR)
-            gl_FragData[PREPASS_REFLECTIVITY_INDEX] = specularMapColor;
+            gl_FragData[PREPASS_REFLECTIVITY_INDEX] = vec3(specularMapColor.rgb, writeGeometryInfo);
         #else
-            gl_FragData[PREPASS_REFLECTIVITY_INDEX] = vec4(0.0, 0.0, 0.0, 1.0);
+            gl_FragData[PREPASS_REFLECTIVITY_INDEX] = vec4(0.0, 0.0, 0.0, writeGeometryInfo);
         #endif
     #endif
 #endif

+ 4 - 4
src/Shaders/pbr.fragment.fx

@@ -532,8 +532,10 @@ void main(void) {
     #define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
 
 #ifdef PREPASS
+    float writeGeometryInfo = finalColor.a > 0.4 ? 1.0 : 0.0;
+    
     #ifdef PREPASS_POSITION
-    gl_FragData[PREPASS_POSITION_INDEX] = vec4(vPositionW, 1.0);
+    gl_FragData[PREPASS_POSITION_INDEX] = vec4(vPositionW, writeGeometryInfo);
     #endif
 
     #ifdef PREPASS_VELOCITY
@@ -543,7 +545,7 @@ void main(void) {
     vec2 velocity = abs(a - b);
     velocity = vec2(pow(velocity.x, 1.0 / 3.0), pow(velocity.y, 1.0 / 3.0)) * sign(a - b) * 0.5 + 0.5;
 
-    gl_FragData[PREPASS_VELOCITY_INDEX] = vec4(velocity, 0.0, 1.0);
+    gl_FragData[PREPASS_VELOCITY_INDEX] = vec4(velocity, 0.0, writeGeometryInfo);
     #endif
 
     #ifdef PREPASS_IRRADIANCE
@@ -567,8 +569,6 @@ void main(void) {
     #else
         gl_FragData[0] = vec4(finalColor.rgb, finalColor.a);
     #endif
-
-    float writeGeometryInfo = finalColor.a > 0.4 ? 1.0 : 0.0;
     
     #ifdef PREPASS_DEPTH
         gl_FragData[PREPASS_DEPTH_INDEX] = vec4(vViewPos.z, 0.0, 0.0, writeGeometryInfo); // Linear depth

BIN
tests/validation/ReferenceImages/prepass-mirror-with-pp.png


BIN
tests/validation/ReferenceImages/prepass-mirror-without-pp.png


BIN
tests/validation/ReferenceImages/prepass-ssao-b-and-w.png


BIN
tests/validation/ReferenceImages/prepass-ssao-bbr.png


BIN
tests/validation/ReferenceImages/prepass-ssao-clip-planes.png


BIN
tests/validation/ReferenceImages/prepass-ssao-depth-renderer.png


BIN
tests/validation/ReferenceImages/prepass-ssao-glow-layer.png


BIN
tests/validation/ReferenceImages/prepass-ssao-gui.png


BIN
tests/validation/ReferenceImages/prepass-ssao-highlight-layer.png


BIN
tests/validation/ReferenceImages/prepass-ssao-line-edges.png


BIN
tests/validation/ReferenceImages/prepass-ssao-lod.png


BIN
tests/validation/ReferenceImages/prepass-ssao-on-off-pp.png


BIN
tests/validation/ReferenceImages/prepass-ssao-point-light.png


BIN
tests/validation/ReferenceImages/prepass-ssao-shadow-only.png


BIN
tests/validation/ReferenceImages/prepass-ssao-sprites.png


BIN
tests/validation/ReferenceImages/prepass-ssao-thin-instances.png


BIN
tests/validation/ReferenceImages/prepass-ssao-visibility.png


+ 102 - 0
tests/validation/config.json

@@ -997,6 +997,108 @@
             "renderCount": 10,
             "playgroundId": "#DX6AV#88",
             "referenceImage": "prepass-ssao-dof.png"
+        },
+        {
+            "title": "Prepass + mirror, without postprocess",
+            "renderCount": 10,
+            "playgroundId": "#PIZ1GK#212",
+            "referenceImage": "prepass-mirror-without-pp.png"
+        },
+        {
+            "title": "Prepass + mirror, with postprocesses",
+            "renderCount": 10,
+            "playgroundId": "#PIZ1GK#213",
+            "referenceImage": "prepass-mirror-with-pp.png"
+        },
+        {
+            "title": "Prepass SSAO + sprites",
+            "renderCount": 10,
+            "playgroundId": "#9RI8CG#187",
+            "referenceImage": "prepass-ssao-sprites.png"
+        },
+        {
+            "title": "Prepass SSAO + glow layer",
+            "renderCount": 10,
+            "playgroundId": "#LRFB2D#114",
+            "referenceImage": "prepass-ssao-glow-layer.png"
+        },
+        {
+            "title": "Prepass SSAO + bounding box renderer",
+            "renderCount": 10,
+            "playgroundId": "#4F33I3#35",
+            "referenceImage": "prepass-ssao-bbr.png"
+        },
+        {
+            "title": "Prepass SSAO + line edges renderer",
+            "renderCount": 10,
+            "playgroundId": "#T90MQ4#3",
+            "referenceImage": "prepass-ssao-line-edges.png"
+        },
+        {
+            "title": "Prepass SSAO + B&W post process",
+            "renderCount": 10,
+            "playgroundId": "#N55Q2M#8",
+            "referenceImage": "prepass-ssao-b-and-w.png"
+        },
+        {
+            "title": "Prepass SSAO + clip planes",
+            "renderCount": 10,
+            "playgroundId": "#Y6W087#71",
+            "referenceImage": "prepass-ssao-clip-planes.png"
+        },
+        {
+            "title": "Prepass SSAO + GUI",
+            "renderCount": 10,
+            "playgroundId": "#LLVZ90#4",
+            "referenceImage": "prepass-ssao-gui.png"
+        },
+        {
+            "title": "Prepass SSAO + LOD",
+            "renderCount": 10,
+            "playgroundId": "#FFMFW5#29",
+            "referenceImage": "prepass-ssao-lod.png"
+        },
+        {
+            "title": "Prepass SSAO + shadow only",
+            "renderCount": 10,
+            "playgroundId": "#1KF7V1#55",
+            "referenceImage": "prepass-ssao-shadow-only.png"
+        },
+        {
+            "title": "Prepass SSAO + highlight layer",
+            "renderCount": 10,
+            "playgroundId": "#1KUJ0A#416",
+            "referenceImage": "prepass-ssao-highlight-layer.png"
+        },
+        {
+            "title": "Prepass SSAO + point light",
+            "renderCount": 10,
+            "playgroundId": "#XDNVAY#5",
+            "referenceImage": "prepass-ssao-point-light.png"
+        },
+        {
+            "title": "Prepass SSAO + on/off post-process",
+            "renderCount": 10,
+            "playgroundId": "#1VI6WV#20",
+            "referenceImage": "prepass-ssao-on-off-pp.png"
+        },
+        {
+            "title": "Prepass SSAO + thin instances",
+            "renderCount": 10,
+            "playgroundId": "#V1JE4Z#25",
+            "referenceImage": "prepass-ssao-thin-instances.png"
+        },
+        {
+            "title": "Prepass SSAO + depth renderer",
+            "renderCount": 10,
+            "playgroundId": "#3HPMAA#1",
+            "referenceImage": "prepass-ssao-depth-renderer.png"
+        },
+        {
+            "title": "Prepass SSAO + visibility",
+            "renderCount": 10,
+            "playgroundId": "#PXC9CF#4",
+            "referenceImage": "prepass-ssao-visibility.png"
         }
     ]
 }