Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-06-14 23:45:20 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-06-15 01:55:45 +0300
commit9c82203e8282551838898061e30422fb4a1a89c8 (patch)
tree63b6015b4c9bd8d679ca1a34379ec5dced0bf6ab /source/blender/draw/engines/eevee/eevee_lightprobes.c
parent99ff1bb21aaf3be13d08badf4e253efd1d0ae407 (diff)
Eevee: Probes: Change falloff of irradiance grid.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_lightprobes.c')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index cc37fb24dfc..0a368229c83 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -378,27 +378,14 @@ static void EEVEE_lightprobes_updates(EEVEE_SceneLayerData *sldata, EEVEE_PassLi
EEVEE_LightProbeEngineData *ped = EEVEE_lightprobe_data_get(ob);
egrid->offset = offset;
+ float fac = 1.0f / max_ff(1e-8f, probe->falloff);
+ egrid->attenuation_scale = fac / max_ff(1e-8f, probe->distinf);
+ egrid->attenuation_bias = fac;
/* Set offset for the next grid */
offset += ped->num_cell;
/* Update transforms */
- float tmp[4][4] = {
- {2.0f, 0.0f, 0.0f, 0.0f},
- {0.0f, 2.0f, 0.0f, 0.0f},
- {0.0f, 0.0f, 2.0f, 0.0f},
- {-1.0f, -1.0f, -1.0f, 1.0f}
- };
- float tmp_grid_mat[4][4] = {
- {1.0f / (float)(probe->grid_resolution_x), 0.0f, 0.0f, 0.0f},
- {0.0f, 1.0f / (float)(probe->grid_resolution_y), 0.0f, 0.0f},
- {0.0f, 0.0f, 1.0f / (float)(probe->grid_resolution_z), 0.0f},
- {0.0f, 0.0f, 0.0f, 1.0f}
- };
- mul_m4_m4m4(tmp, tmp, tmp_grid_mat);
- mul_m4_m4m4(egrid->mat, ob->obmat, tmp);
- invert_m4(egrid->mat);
-
float cell_dim[3], half_cell_dim[3];
cell_dim[0] = 2.0f / (float)(probe->grid_resolution_x);
cell_dim[1] = 2.0f / (float)(probe->grid_resolution_y);
@@ -406,6 +393,9 @@ static void EEVEE_lightprobes_updates(EEVEE_SceneLayerData *sldata, EEVEE_PassLi
mul_v3_v3fl(half_cell_dim, cell_dim, 0.5f);
+ /* Matrix converting world space to cell ranges. */
+ invert_m4_m4(egrid->mat, ob->obmat);
+
/* First cell. */
copy_v3_fl(egrid->corner, -1.0f);
add_v3_v3(egrid->corner, half_cell_dim);