summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/shaders/resolve.glsl
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2021-07-05 14:48:23 -0300
committerreduz <reduzio@gmail.com>2021-07-05 17:17:45 -0300
commit7f6027927a235f9ed7d4b5e7d06df90632cfbf11 (patch)
tree5207b52b59892175eea8cdfbf7fdcd4baf9993c0 /servers/rendering/renderer_rd/shaders/resolve.glsl
parent8cd1b59ea78f5145eae1762e2b1311c1a1b92cbc (diff)
Fix Subsurface Scattering
* Works again * Transmittance also works again * Removed the curve patamter, exp() function is good enough.
Diffstat (limited to 'servers/rendering/renderer_rd/shaders/resolve.glsl')
-rw-r--r--servers/rendering/renderer_rd/shaders/resolve.glsl16
1 files changed, 16 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/shaders/resolve.glsl b/servers/rendering/renderer_rd/shaders/resolve.glsl
index a4610e081c..fecf812a8c 100644
--- a/servers/rendering/renderer_rd/shaders/resolve.glsl
+++ b/servers/rendering/renderer_rd/shaders/resolve.glsl
@@ -6,6 +6,11 @@
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
+#ifdef MODE_RESOLVE_DEPTH
+layout(set = 0, binding = 0) uniform sampler2DMS source_depth;
+layout(r32f, set = 1, binding = 0) uniform restrict writeonly image2D dest_depth;
+#endif
+
#ifdef MODE_RESOLVE_GI
layout(set = 0, binding = 0) uniform sampler2DMS source_depth;
layout(set = 0, binding = 1) uniform sampler2DMS source_normal_roughness;
@@ -34,6 +39,17 @@ void main() {
return;
}
+#ifdef MODE_RESOLVE_DEPTH
+
+ float depth_avg = 0.0;
+ for (int i = 0; i < params.sample_count; i++) {
+ depth_avg += texelFetch(source_depth, pos, i).r;
+ }
+ depth_avg /= float(params.sample_count);
+ imageStore(dest_depth, pos, vec4(depth_avg));
+
+#endif
+
#ifdef MODE_RESOLVE_GI
float best_depth = 1e20;