summaryrefslogtreecommitdiff
path: root/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-28 14:42:03 +0200
committerGitHub <noreply@github.com>2020-06-28 14:42:03 +0200
commit481151be09108a30002ae0a9df118eeddd3987be (patch)
treefed2ea1e0b2eef9df8ac20eeb3de416246b876df /servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
parente1ef3f2da6bdfe53f08aee4e154584b14f09c0aa (diff)
parentb1aa24ea3c259fd018dde8370ef45678c7ef00ec (diff)
Merge pull request #39916 from reduz/sdfgi-occ
SDFGI: Slight occlusion improvements.
Diffstat (limited to 'servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl')
-rw-r--r--servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl99
1 files changed, 0 insertions, 99 deletions
diff --git a/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl b/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
index 7a523d3a3c..d7d19897e3 100644
--- a/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/sdfgi_preprocess.glsl
@@ -655,105 +655,6 @@ void main() {
groupMemoryBarrier();
barrier();
}
- /*
- for(int s=0;s<8;s++) {
- ivec3 local_pos = pos * 2 + ((ivec3(s) >> ivec3(2,1,0)) & ivec3(1,1,1));
- for(int i=0;i<8;i++) {
- ivec3 offset = local_pos + ((ivec3(i) >> ivec3(2,1,0)) & ivec3(1,1,1)) * OCCLUSION_SIZE;
-
- ivec3 global_offset = region_offset + offset;
-
- if (any(lessThan(global_offset,ivec3(0))) || any(greaterThanEqual(global_offset,ivec3(params.grid_size)))) {
- continue; // do not process
- }
-
- ivec3 proc_pos = offset - ivec3(OCCLUSION_SIZE);
- proc_pos += mix(ivec3(0),ivec3(1),greaterThanEqual(proc_pos,ivec3(0)));
-
- ivec3 proc_abs = abs(proc_pos);
- ivec3 proc_pass = proc_abs - ivec3(1);
-
- if (proc_pass.x+proc_pass.y+proc_pass.z != step) {
- continue;
- }
-
- offset = global_offset;
-
- float occ;
-
- uint facing = imageLoad(src_facing,offset).r; //any bit present in facing means this is solid
-
- if (facing != 0) { //solid
- occ = 0.0;
- } else if (step==0) {
- occ = 1.0; //first step
- } else {
- ivec3 read_dir = -sign(proc_pos);
-
- ivec3 major_axis;
- if (proc_pass.x < proc_pass.y) {
- if (proc_pass.z < proc_pass.y) {
- major_axis = ivec3(0,1,0);
- } else {
- major_axis = ivec3(0,0,1);
- }
- } else {
- if (proc_pass.z < proc_pass.x) {
- major_axis = ivec3(1,0,0);
- } else {
- major_axis = ivec3(0,0,1);
- }
- }
-
- float avg = 0.0;
- occ = 0.0;
-
- ivec3 read_x = offset + ivec3(read_dir.x,0,0) + (proc_pass.x == 0 ? major_axis * read_dir : ivec3(0));
- ivec3 read_y = offset + ivec3(0,read_dir.y,0) + (proc_pass.y == 0 ? major_axis * read_dir : ivec3(0));
- ivec3 read_z = offset + ivec3(0,0,read_dir.z) + (proc_pass.z == 0 ? major_axis * read_dir : ivec3(0));
-
- if (all(greaterThanEqual(read_x,ivec3(0))) && all(lessThan(read_x,ivec3(params.grid_size)))) {
-
- uint f = imageLoad(src_facing,read_x).r;
- if (f==0) { //non solid
- occ += imageLoad(dst_occlusion[params.occlusion_index],read_x).r;
- avg+=1.0;
- }
- }
-
- if (all(greaterThanEqual(read_y,ivec3(0))) && all(lessThan(read_y,ivec3(params.grid_size)))) {
-
- uint f = imageLoad(src_facing,read_y).r;
- if (f==0) {//non solid
- occ += imageLoad(dst_occlusion[params.occlusion_index],read_y).r;
- avg+=1.0;
- }
- }
-
- if (all(greaterThanEqual(read_z,ivec3(0))) && all(lessThan(read_z,ivec3(params.grid_size)))) {
-
- uint f = imageLoad(src_facing,read_z).r;
- if (f==0) {//non solid
- occ += imageLoad(dst_occlusion[params.occlusion_index],read_z).r;
- avg+=1.0;
- }
- }
-
- if (avg > 0.0) {
- occ/=avg;
- }
- }
-
- imageStore(dst_occlusion[params.occlusion_index],offset,vec4(occ));
-
- }
- }
-
- groupMemoryBarrier();
- barrier();
-
- }
-*/
#if 1
//bias solid voxels away