diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 14:09:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 14:09:42 -0300 |
commit | 2820b2d82b2ed747011e37c543aefc6d4d4edee9 (patch) | |
tree | 3717c04980978fdf2415f797a5d10f92639e5307 | |
parent | 741e0386717ccfecbd67ae66775699bdf4db3bb0 (diff) |
fix stupid bug in light downscaling for GI Probe
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 6b170d3797..91694c3e12 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2917,6 +2917,8 @@ void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const G p_local_data[p_idx].energy[1]=0; p_local_data[p_idx].energy[2]=0; + int divisor=0; + for(int i=0;i<8;i++) { uint32_t child = p_cells[p_idx].children[i]; @@ -2931,13 +2933,14 @@ void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const G p_local_data[p_idx].energy[0]+=p_local_data[child].energy[0]; p_local_data[p_idx].energy[1]+=p_local_data[child].energy[1]; p_local_data[p_idx].energy[2]+=p_local_data[child].energy[2]; + divisor++; } //divide by eight for average - p_local_data[p_idx].energy[0]>>=3; - p_local_data[p_idx].energy[1]>>=3; - p_local_data[p_idx].energy[2]>>=3; + p_local_data[p_idx].energy[0]/=divisor; + p_local_data[p_idx].energy[1]/=divisor; + p_local_data[p_idx].energy[2]/=divisor; } |