1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Fix Subsurface Scattering

* Works again
* Transmittance also works again
* Removed the curve patamter, exp() function is good enough.
This commit is contained in:
reduz
2021-07-05 14:48:23 -03:00
parent 8cd1b59ea7
commit 7f6027927a
13 changed files with 310 additions and 369 deletions

View File

@@ -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;