summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-11-01 22:28:53 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 12:05:05 +0100
commit4949d578f23d1d708ff4d36d98c74925578cf3ae (patch)
tree9f8d640a3e32f44fddf1fd18c575c98745989c6a /servers
parentd6e4b4599435ea816bd15370f9fae129af5675a2 (diff)
Dynamic objects in GIProbes are now affected by propagation parameter.
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp4
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_rd.h2
-rw-r--r--servers/visual/rasterizer_rd/shaders/giprobe.glsl10
3 files changed, 14 insertions, 2 deletions
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
index 2f843b92fc..4e2fd0a7f7 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -1949,6 +1949,10 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
push_constant.prev_rect_size[0] = 0;
push_constant.prev_rect_size[1] = 0;
push_constant.on_mipmap = false;
+ push_constant.propagation = storage->gi_probe_get_propagation(gi_probe->probe);
+ push_constant.pad[0]=0;
+ push_constant.pad[1]=0;
+ push_constant.pad[2]=0;
//process lighting
RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h b/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
index 59db75eb85..cd5195456d 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
@@ -174,6 +174,8 @@ private:
uint32_t flip_y;
float dynamic_range;
uint32_t on_mipmap;
+ float propagation;
+ float pad[3];
};
struct GIProbeInstance {
diff --git a/servers/visual/rasterizer_rd/shaders/giprobe.glsl b/servers/visual/rasterizer_rd/shaders/giprobe.glsl
index 774819c8c4..281156d251 100644
--- a/servers/visual/rasterizer_rd/shaders/giprobe.glsl
+++ b/servers/visual/rasterizer_rd/shaders/giprobe.glsl
@@ -149,7 +149,8 @@ layout(push_constant, binding = 0, std430) uniform Params {
bool flip_y;
float dynamic_range;
bool on_mipmap;
-
+ float propagation;
+ float pad[3];
} params;
#ifdef MODE_DYNAMIC_LIGHTING
@@ -753,7 +754,12 @@ void main() {
}
- accum/=params.on_mipmap ? 8.0 : 4.0;
+ if (params.on_mipmap) {
+ accum.rgb /= mix(8.0,count,params.propagation);
+ accum.a /= 8.0;
+ } else {
+ accum/=4.0;
+ }
if (count==0.0) {
accum_z=0.0; //avoid nan