Blender  V2.93
eevee_lightprobes.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2016, Blender Foundation.
17  */
18 
23 #include "DRW_render.h"
24 
25 #include "BLI_rand.h"
26 #include "BLI_string_utils.h"
27 #include "BLI_utildefines.h"
28 
29 #include "DNA_image_types.h"
30 #include "DNA_lightprobe_types.h"
31 #include "DNA_texture_types.h"
32 #include "DNA_view3d_types.h"
33 #include "DNA_world_types.h"
34 
35 #include "BKE_collection.h"
36 #include "BKE_object.h"
37 #include "MEM_guardedalloc.h"
38 
39 #include "GPU_capabilities.h"
40 #include "GPU_material.h"
41 #include "GPU_texture.h"
42 #include "GPU_uniform_buffer.h"
43 
44 #include "DEG_depsgraph_query.h"
45 
46 #include "eevee_lightcache.h"
47 #include "eevee_private.h"
48 
49 #include "WM_api.h"
50 #include "WM_types.h"
51 
52 static struct {
56 
58 } e_data = {NULL}; /* Engine data */
59 
60 /* *********** FUNCTIONS *********** */
61 
62 /* TODO find a better way than this. This does not support dupli objects if
63  * the original object is hidden. */
65 {
67 
68  /* test disabled if group is NULL */
69  if (oed == NULL || oed->test_data->collection == NULL) {
70  return vis_in;
71  }
72 
73  if (oed->test_data->cached == false) {
74  oed->ob_vis_dirty = true;
75  }
76 
77  /* early out, don't need to compute ob_vis yet. */
78  if (vis_in == false) {
79  return vis_in;
80  }
81 
82  if (oed->ob_vis_dirty) {
83  oed->ob_vis_dirty = false;
85  oed->ob_vis = (oed->test_data->invert) ? !oed->ob_vis : oed->ob_vis;
86  }
87 
88  return vis_in && oed->ob_vis;
89 }
90 
91 static void planar_pool_ensure_alloc(EEVEE_Data *vedata, int num_planar_ref)
92 {
93  EEVEE_TextureList *txl = vedata->txl;
94  EEVEE_StorageList *stl = vedata->stl;
95  EEVEE_EffectsInfo *fx = stl->effects;
96 
97  /* XXX TODO OPTIMIZATION: This is a complete waist of texture memory.
98  * Instead of allocating each planar probe for each viewport,
99  * only alloc them once using the biggest viewport resolution. */
100 
101  /* TODO get screen percentage from layer setting */
102  // const DRWContextState *draw_ctx = DRW_context_state_get();
103  // ViewLayer *view_layer = draw_ctx->view_layer;
104  int screen_divider = 1;
105 
106  int width = max_ii(1, fx->hiz_size[0] / screen_divider);
107  int height = max_ii(1, fx->hiz_size[1] / screen_divider);
108 
109  /* Fix case were the pool was allocated width the dummy size (1,1,1). */
110  if (txl->planar_pool && (num_planar_ref > 0) &&
111  (GPU_texture_width(txl->planar_pool) != width ||
115  }
116 
117  /* We need an Array texture so allocate it ourself */
118  if (!txl->planar_pool) {
119  if (num_planar_ref > 0) {
121  height,
122  num_planar_ref,
125  NULL);
127  width, height, num_planar_ref, GPU_DEPTH_COMPONENT24, 0, NULL);
128  }
129  else if (num_planar_ref == 0) {
130  /* Makes Opengl Happy : Create a placeholder texture that will never be sampled but still
131  * bound to shader. */
135  }
136  }
137 }
138 
140 {
141  EEVEE_CommonUniformBuffer *common_data = &sldata->common_data;
142  EEVEE_StorageList *stl = vedata->stl;
143 
144  const DRWContextState *draw_ctx = DRW_context_state_get();
145  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
146  vedata->info[0] = '\0';
147 
149 
150  memset(stl->g_data->bake_views, 0, sizeof(stl->g_data->bake_views));
151  memset(stl->g_data->cube_views, 0, sizeof(stl->g_data->cube_views));
152  memset(stl->g_data->world_views, 0, sizeof(stl->g_data->world_views));
153  memset(stl->g_data->planar_views, 0, sizeof(stl->g_data->planar_views));
154 
155  if (EEVEE_lightcache_load(scene_eval->eevee.light_cache_data)) {
156  stl->g_data->light_cache = scene_eval->eevee.light_cache_data;
157  }
158  else {
159  if (scene_eval->eevee.light_cache_data &&
161  /* Error message info. */
162  BLI_snprintf(
163  vedata->info, sizeof(vedata->info), "Error: LightCache cannot be loaded on this GPU");
164  }
165 
166  if (!sldata->fallback_lightcache) {
167 #if defined(IRRADIANCE_SH_L2)
168  int grid_res = 4;
169 #elif defined(IRRADIANCE_HL2)
170  int grid_res = 4;
171 #endif
173  1,
174  1,
175  scene_eval->eevee.gi_cubemap_resolution,
176  scene_eval->eevee.gi_visibility_resolution,
177  (int[3]){grid_res, grid_res, 1});
178  }
179  stl->g_data->light_cache = sldata->fallback_lightcache;
180  }
181 
182  if (!sldata->probes) {
183  sldata->probes = MEM_callocN(sizeof(EEVEE_LightProbesInfo), "EEVEE_LightProbesInfo");
187  }
188 
189  common_data->prb_num_planar = 0;
190  common_data->prb_num_render_cube = 1;
191  common_data->prb_num_render_grid = 1;
192 
193  common_data->spec_toggle = true;
194  common_data->ssr_toggle = true;
195  common_data->ssrefract_toggle = true;
196  common_data->sss_toggle = true;
197 
198  /* Placeholder planar pool: used when rendering planar reflections (avoid dependency loop). */
199  if (!e_data.planar_pool_placeholder) {
200  e_data.planar_pool_placeholder = DRW_texture_create_2d_array(
201  1, 1, 1, GPU_RGBA8, DRW_TEX_FILTER, NULL);
202  }
203 }
204 
205 /* Only init the passes useful for rendering the light cache. */
207  EEVEE_Data *vedata,
208  GPUTexture *rt_color,
209  GPUTexture *rt_depth)
210 {
211  EEVEE_PassList *psl = vedata->psl;
212  LightCache *light_cache = vedata->stl->g_data->light_cache;
213  EEVEE_LightProbesInfo *pinfo = sldata->probes;
214 
215  {
217 
219  psl->probe_glossy_compute);
220 
221  DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1);
222  DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
223  DRW_shgroup_uniform_float(grp, "roughness", &pinfo->roughness, 1);
224  DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
225  DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
226  DRW_shgroup_uniform_float(grp, "texelSize", &pinfo->texel_size, 1);
227  DRW_shgroup_uniform_float(grp, "paddingSize", &pinfo->padding_size, 1);
228  DRW_shgroup_uniform_float(grp, "fireflyFactor", &pinfo->firefly_fac, 1);
229  DRW_shgroup_uniform_int(grp, "Layer", &pinfo->layer, 1);
230  // DRW_shgroup_uniform_texture(grp, "texJitter", e_data.jitter);
231  DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color);
232  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
233  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
234 
235  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
236  DRW_shgroup_call_instances(grp, NULL, geom, 6);
237  }
238 
239  {
242  psl->probe_diffuse_compute);
243 #ifdef IRRADIANCE_SH_L2
244  DRW_shgroup_uniform_int(grp, "probeSize", &pinfo->shres, 1);
245 #else
246  DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
247  DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
248  DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
249 #endif
250  DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1);
251  DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color);
252  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
253  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
254 
255  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
256  DRW_shgroup_call(grp, geom, NULL);
257  }
258 
259  {
263  DRW_shgroup_uniform_int(grp, "outputSize", &pinfo->shres, 1);
264  DRW_shgroup_uniform_float(grp, "visibilityRange", &pinfo->visibility_range, 1);
265  DRW_shgroup_uniform_float(grp, "visibilityBlur", &pinfo->visibility_blur, 1);
266  DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
267  DRW_shgroup_uniform_float(grp, "storedTexelSize", &pinfo->texel_size, 1);
268  DRW_shgroup_uniform_float(grp, "nearClip", &pinfo->near_clip, 1);
269  DRW_shgroup_uniform_float(grp, "farClip", &pinfo->far_clip, 1);
270  DRW_shgroup_uniform_texture(grp, "probeDepth", rt_depth);
271  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
272  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
273 
274  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
275  DRW_shgroup_call(grp, geom, NULL);
276  }
277 
278  {
280 
282  psl->probe_grid_fill);
283 
284  DRW_shgroup_uniform_texture_ref(grp, "irradianceGrid", &light_cache->grid_tx.tex);
285 
286  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
287  DRW_shgroup_call(grp, geom, NULL);
288  }
289 }
290 
292 {
293  EEVEE_TextureList *txl = vedata->txl;
294  EEVEE_PassList *psl = vedata->psl;
295  EEVEE_StorageList *stl = vedata->stl;
296  EEVEE_LightProbesInfo *pinfo = sldata->probes;
297  LightCache *lcache = stl->g_data->light_cache;
298  const DRWContextState *draw_ctx = DRW_context_state_get();
299  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
300 
301  pinfo->num_planar = 0;
302  pinfo->vis_data.collection = NULL;
303  pinfo->do_grid_update = false;
304  pinfo->do_cube_update = false;
305 
306  {
308 
309  DRWShadingGroup *grp = NULL;
310  EEVEE_lookdev_cache_init(vedata, sldata, psl->probe_background, pinfo, &grp);
311 
312  if (grp == NULL) {
313  Scene *scene = draw_ctx->scene;
315 
317  struct GPUMaterial *gpumat = EEVEE_material_get(vedata, scene, NULL, world, options);
318 
319  grp = DRW_shgroup_material_create(gpumat, psl->probe_background);
320  DRW_shgroup_uniform_float_copy(grp, "backgroundAlpha", 1.0f);
321  }
322 
323  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
324  DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo);
325  DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo);
326  DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo);
327  DRW_shgroup_uniform_block(grp, "light_block", sldata->light_ubo);
328  DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo);
329  DRW_shgroup_uniform_block_ref(grp, "renderpass_block", &stl->g_data->renderpass_ubo);
331  }
332 
333  if (DRW_state_draw_support()) {
337 
338  if (!LOOK_DEV_STUDIO_LIGHT_ENABLED(draw_ctx->v3d)) {
339  /* Cube Display */
340  if (scene_eval->eevee.flag & SCE_EEVEE_SHOW_CUBEMAPS && lcache->cube_len > 1) {
341  int cube_len = lcache->cube_len - 1; /* don't count the world. */
343  psl->probe_display);
344 
345  DRW_shgroup_uniform_texture_ref(grp, "probeCubes", &lcache->cube_tx.tex);
346  DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo);
347  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
348  DRW_shgroup_uniform_vec3(grp, "screen_vecs", DRW_viewport_screenvecs_get(), 2);
350  grp, "sphere_size", scene_eval->eevee.gi_cubemap_draw_size * 0.5f);
351  /* TODO(fclem): get rid of those UBO. */
352  DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo);
353  DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo);
354  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
355 
356  DRW_shgroup_call_procedural_triangles(grp, NULL, cube_len * 2);
357  }
358 
359  /* Grid Display */
360  if (scene_eval->eevee.flag & SCE_EEVEE_SHOW_IRRADIANCE) {
361  EEVEE_LightGrid *egrid = lcache->grid_data + 1;
362  for (int p = 1; p < lcache->grid_len; p++, egrid++) {
364  psl->probe_display);
365 
366  DRW_shgroup_uniform_int(shgrp, "offset", &egrid->offset, 1);
367  DRW_shgroup_uniform_ivec3(shgrp, "grid_resolution", egrid->resolution, 1);
368  DRW_shgroup_uniform_vec3(shgrp, "corner", egrid->corner, 1);
369  DRW_shgroup_uniform_vec3(shgrp, "increment_x", egrid->increment_x, 1);
370  DRW_shgroup_uniform_vec3(shgrp, "increment_y", egrid->increment_y, 1);
371  DRW_shgroup_uniform_vec3(shgrp, "increment_z", egrid->increment_z, 1);
372  DRW_shgroup_uniform_vec3(shgrp, "screen_vecs", DRW_viewport_screenvecs_get(), 2);
373  DRW_shgroup_uniform_texture_ref(shgrp, "irradianceGrid", &lcache->grid_tx.tex);
375  shgrp, "sphere_size", scene_eval->eevee.gi_irradiance_draw_size * 0.5f);
376  /* TODO(fclem): get rid of those UBO. */
377  DRW_shgroup_uniform_block(shgrp, "probe_block", sldata->probe_ubo);
378  DRW_shgroup_uniform_block(shgrp, "planar_block", sldata->planar_ubo);
379  DRW_shgroup_uniform_block(shgrp, "grid_block", sldata->grid_ubo);
380  DRW_shgroup_uniform_block(shgrp, "common_block", sldata->common_ubo);
381  DRW_shgroup_uniform_block(shgrp, "renderpass_block", sldata->renderpass_ubo.combined);
382  int tri_count = egrid->resolution[0] * egrid->resolution[1] * egrid->resolution[2] * 2;
383  DRW_shgroup_call_procedural_triangles(shgrp, NULL, tri_count);
384  }
385  }
386  }
387 
388  /* Planar Display */
389  {
390  DRW_shgroup_instance_format(e_data.format_probe_display_planar,
391  {
392  {"probe_id", DRW_ATTR_INT, 1},
393  {"probe_mat", DRW_ATTR_FLOAT, 16},
394  });
395 
397  psl->probe_display);
398  DRW_shgroup_uniform_texture_ref(grp, "probePlanars", &txl->planar_pool);
399  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
400 
402  grp, e_data.format_probe_display_planar, DRW_cache_quad_get());
403  }
404  }
405  else {
406  stl->g_data->planar_display_shgrp = NULL;
407  }
408 }
409 
411 {
412  LightProbe *probe = (LightProbe *)ob->data;
413 
414  switch (probe->type) {
415  case LIGHTPROBE_TYPE_PLANAR: {
416  /* See if this planar probe is inside the view frustum. If not, no need to update it. */
417  /* NOTE: this could be bypassed if we want feedback loop mirrors for rendering. */
418  BoundBox bbox;
419  float tmp[4][4];
420  const float min[3] = {-1.0f, -1.0f, -1.0f};
421  const float max[3] = {1.0f, 1.0f, 1.0f};
423 
424  copy_m4_m4(tmp, ob->obmat);
425  normalize_v3(tmp[2]);
426  mul_v3_fl(tmp[2], probe->distinf);
427 
428  for (int v = 0; v < 8; v++) {
429  mul_m4_v3(tmp, bbox.vec[v]);
430  }
431  const DRWView *default_view = DRW_view_default_get();
432  return DRW_culling_box_test(default_view, &bbox);
433  }
435  return true; /* TODO */
437  return true; /* TODO */
438  }
439  BLI_assert(0);
440  return true;
441 }
442 
444 {
445  EEVEE_LightProbesInfo *pinfo = sldata->probes;
446  LightProbe *probe = (LightProbe *)ob->data;
447 
448  if ((probe->type == LIGHTPROBE_TYPE_CUBE && pinfo->num_cube >= EEVEE_PROBE_MAX) ||
449  (probe->type == LIGHTPROBE_TYPE_GRID && pinfo->num_grid >= EEVEE_PROBE_MAX) ||
450  (probe->type == LIGHTPROBE_TYPE_PLANAR && pinfo->num_planar >= MAX_PLANAR)) {
451  printf("Too many probes in the view !!!\n");
452  return;
453  }
454 
455  if (probe->type == LIGHTPROBE_TYPE_PLANAR) {
456  /* TODO(fclem): Culling should be done after cache generation.
457  * This is needed for future draw cache persistence. */
459  return; /* Culled */
460  }
462  ob, &pinfo->planar_data[pinfo->num_planar], &pinfo->planar_vis_tests[pinfo->num_planar]);
463  /* Debug Display */
464  DRWCallBuffer *grp = vedata->stl->g_data->planar_display_shgrp;
465  if (grp && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
466  DRW_buffer_add_entry(grp, &pinfo->num_planar, ob->obmat);
467  }
468 
469  pinfo->num_planar++;
470  }
471  else {
473  if (ped->need_update) {
474  if (probe->type == LIGHTPROBE_TYPE_GRID) {
475  pinfo->do_grid_update = true;
476  }
477  else {
478  pinfo->do_cube_update = true;
479  }
480  ped->need_update = false;
481  }
482  }
483 }
484 
486 {
487  LightProbe *probe = (LightProbe *)ob->data;
488 
490 
491  /* Save current offset and advance it for the next grid. */
492  egrid->offset = *offset;
493  *offset += egrid->resolution[0] * egrid->resolution[1] * egrid->resolution[2];
494 
495  /* Add one for level 0 */
496  float fac = 1.0f / max_ff(1e-8f, probe->falloff);
497  egrid->attenuation_scale = fac / max_ff(1e-8f, probe->distinf);
498  egrid->attenuation_bias = fac;
499 
500  /* Update transforms */
501  float cell_dim[3], half_cell_dim[3];
502  cell_dim[0] = 2.0f / egrid->resolution[0];
503  cell_dim[1] = 2.0f / egrid->resolution[1];
504  cell_dim[2] = 2.0f / egrid->resolution[2];
505 
506  mul_v3_v3fl(half_cell_dim, cell_dim, 0.5f);
507 
508  /* Matrix converting world space to cell ranges. */
509  invert_m4_m4(egrid->mat, ob->obmat);
510 
511  /* First cell. */
512  copy_v3_fl(egrid->corner, -1.0f);
513  add_v3_v3(egrid->corner, half_cell_dim);
514  mul_m4_v3(ob->obmat, egrid->corner);
515 
516  /* Opposite neighbor cell. */
517  copy_v3_fl3(egrid->increment_x, cell_dim[0], 0.0f, 0.0f);
518  add_v3_v3(egrid->increment_x, half_cell_dim);
519  add_v3_fl(egrid->increment_x, -1.0f);
520  mul_m4_v3(ob->obmat, egrid->increment_x);
521  sub_v3_v3(egrid->increment_x, egrid->corner);
522 
523  copy_v3_fl3(egrid->increment_y, 0.0f, cell_dim[1], 0.0f);
524  add_v3_v3(egrid->increment_y, half_cell_dim);
525  add_v3_fl(egrid->increment_y, -1.0f);
526  mul_m4_v3(ob->obmat, egrid->increment_y);
527  sub_v3_v3(egrid->increment_y, egrid->corner);
528 
529  copy_v3_fl3(egrid->increment_z, 0.0f, 0.0f, cell_dim[2]);
530  add_v3_v3(egrid->increment_z, half_cell_dim);
531  add_v3_fl(egrid->increment_z, -1.0f);
532  mul_m4_v3(ob->obmat, egrid->increment_z);
533  sub_v3_v3(egrid->increment_z, egrid->corner);
534 
535  /* Visibility bias */
536  egrid->visibility_bias = 0.05f * probe->vis_bias;
537  egrid->visibility_bleed = probe->vis_bleedbias;
538  egrid->visibility_range = 1.0f + sqrtf(max_fff(len_squared_v3(egrid->increment_x),
539  len_squared_v3(egrid->increment_y),
540  len_squared_v3(egrid->increment_z)));
541 }
542 
544 {
545  LightProbe *probe = (LightProbe *)ob->data;
546 
547  /* Update transforms */
548  copy_v3_v3(eprobe->position, ob->obmat[3]);
549 
550  /* Attenuation */
551  eprobe->attenuation_type = probe->attenuation_type;
552  eprobe->attenuation_fac = 1.0f / max_ff(1e-8f, probe->falloff);
553 
554  unit_m4(eprobe->attenuationmat);
555  scale_m4_fl(eprobe->attenuationmat, probe->distinf);
556  mul_m4_m4m4(eprobe->attenuationmat, ob->obmat, eprobe->attenuationmat);
557  invert_m4(eprobe->attenuationmat);
558 
559  /* Parallax */
560  unit_m4(eprobe->parallaxmat);
561 
562  if ((probe->flag & LIGHTPROBE_FLAG_CUSTOM_PARALLAX) != 0) {
563  eprobe->parallax_type = probe->parallax_type;
564  scale_m4_fl(eprobe->parallaxmat, probe->distpar);
565  }
566  else {
567  eprobe->parallax_type = probe->attenuation_type;
568  scale_m4_fl(eprobe->parallaxmat, probe->distinf);
569  }
570 
571  mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat);
572  invert_m4(eprobe->parallaxmat);
573 }
574 
576  EEVEE_PlanarReflection *eplanar,
577  EEVEE_LightProbeVisTest *vis_test)
578 {
579  LightProbe *probe = (LightProbe *)ob->data;
580  float normat[4][4], imat[4][4];
581 
582  vis_test->collection = probe->visibility_grp;
583  vis_test->invert = probe->flag & LIGHTPROBE_FLAG_INVERT_GROUP;
584  vis_test->cached = false;
585 
586  /* Computing mtx : matrix that mirror position around object's XY plane. */
587  normalize_m4_m4(normat, ob->obmat); /* object > world */
588  invert_m4_m4(imat, normat); /* world > object */
589  /* XY reflection plane */
590  imat[0][2] = -imat[0][2];
591  imat[1][2] = -imat[1][2];
592  imat[2][2] = -imat[2][2];
593  imat[3][2] = -imat[3][2]; /* world > object > mirrored obj */
594  mul_m4_m4m4(eplanar->mtx, normat, imat); /* world > object > mirrored obj > world */
595 
596  /* Compute clip plane equation / normal. */
597  copy_v3_v3(eplanar->plane_equation, ob->obmat[2]);
598  normalize_v3(eplanar->plane_equation); /* plane normal */
599  eplanar->plane_equation[3] = -dot_v3v3(eplanar->plane_equation, ob->obmat[3]);
600  eplanar->clipsta = probe->clipsta;
601 
602  /* Compute XY clip planes. */
603  normalize_v3_v3(eplanar->clip_vec_x, ob->obmat[0]);
604  normalize_v3_v3(eplanar->clip_vec_y, ob->obmat[1]);
605 
606  float vec[3] = {0.0f, 0.0f, 0.0f};
607  vec[0] = 1.0f;
608  vec[1] = 0.0f;
609  vec[2] = 0.0f;
610  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
611  eplanar->clip_edge_x_pos = dot_v3v3(eplanar->clip_vec_x, vec);
612 
613  vec[0] = 0.0f;
614  vec[1] = 1.0f;
615  vec[2] = 0.0f;
616  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
617  eplanar->clip_edge_y_pos = dot_v3v3(eplanar->clip_vec_y, vec);
618 
619  vec[0] = -1.0f;
620  vec[1] = 0.0f;
621  vec[2] = 0.0f;
622  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
623  eplanar->clip_edge_x_neg = dot_v3v3(eplanar->clip_vec_x, vec);
624 
625  vec[0] = 0.0f;
626  vec[1] = -1.0f;
627  vec[2] = 0.0f;
628  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
629  eplanar->clip_edge_y_neg = dot_v3v3(eplanar->clip_vec_y, vec);
630 
631  /* Facing factors */
632  float max_angle = max_ff(1e-2f, 1.0f - probe->falloff) * M_PI * 0.5f;
633  float min_angle = 0.0f;
634  eplanar->facing_scale = 1.0f / max_ff(1e-8f, cosf(min_angle) - cosf(max_angle));
635  eplanar->facing_bias = -min_ff(1.0f - 1e-8f, cosf(max_angle)) * eplanar->facing_scale;
636 
637  /* Distance factors */
638  float max_dist = probe->distinf;
639  float min_dist = min_ff(1.0f - 1e-8f, 1.0f - probe->falloff) * probe->distinf;
640  eplanar->attenuation_scale = -1.0f / max_ff(1e-8f, max_dist - min_dist);
641  eplanar->attenuation_bias = max_dist * -eplanar->attenuation_scale;
642 }
643 
645  const DRWView *main_view,
646  DRWView **r_planar_view)
647 {
648  float winmat[4][4], viewmat[4][4], persmat[4][4];
649  DRW_view_viewmat_get(main_view, viewmat, false);
650  /* Temporal sampling jitter should be already applied to the DRW_MAT_WIN. */
651  DRW_view_winmat_get(main_view, winmat, false);
652  DRW_view_persmat_get(main_view, persmat, false);
653 
654  /* Invert X to avoid flipping the triangle facing direction. */
655  winmat[0][0] = -winmat[0][0];
656  winmat[1][0] = -winmat[1][0];
657  winmat[2][0] = -winmat[2][0];
658  winmat[3][0] = -winmat[3][0];
659  /* Reflect Camera Matrix. */
660  mul_m4_m4m4(viewmat, viewmat, eplanar->mtx);
661 
662  if (*r_planar_view == NULL) {
663  *r_planar_view = DRW_view_create(
664  viewmat, winmat, NULL, NULL, EEVEE_lightprobes_obj_visibility_cb);
665  /* Compute offset plane equation (fix missing texels near reflection plane). */
666  float clip_plane[4];
667  copy_v4_v4(clip_plane, eplanar->plane_equation);
668  clip_plane[3] += eplanar->clipsta;
669  /* Set clipping plane */
670  DRW_view_clip_planes_set(*r_planar_view, &clip_plane, 1);
671  }
672  else {
673  DRW_view_update(*r_planar_view, viewmat, winmat, NULL, NULL);
674  }
675 }
676 
678 {
679  /* copy the entire cache for now (up to MAX_PROBE) */
680  /* TODO: frustum cull to only add visible probes. */
681  memcpy(pinfo->probe_data,
682  lcache->cube_data,
683  sizeof(EEVEE_LightProbe) * max_ii(1, min_ii(lcache->cube_len, MAX_PROBE)));
684  /* TODO: compute the max number of grid based on sample count. */
685  memcpy(pinfo->grid_data,
686  lcache->grid_data,
687  sizeof(EEVEE_LightGrid) * max_ii(1, min_ii(lcache->grid_len, MAX_GRID)));
688 }
689 
691 {
692  EEVEE_StorageList *stl = vedata->stl;
693  LightCache *light_cache = stl->g_data->light_cache;
694  EEVEE_LightProbesInfo *pinfo = sldata->probes;
695  const DRWContextState *draw_ctx = DRW_context_state_get();
696  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
697 
698  eevee_lightprobes_extract_from_cache(sldata->probes, light_cache);
699 
700  GPU_uniformbuf_update(sldata->probe_ubo, &sldata->probes->probe_data);
701  GPU_uniformbuf_update(sldata->grid_ubo, &sldata->probes->grid_data);
702 
703  /* For shading, save max level of the octahedron map */
704  sldata->common_data.prb_lod_cube_max = (float)light_cache->mips_len;
705  sldata->common_data.prb_irradiance_vis_size = light_cache->vis_res;
707  sldata->common_data.prb_num_render_cube = max_ii(1, light_cache->cube_len);
708  sldata->common_data.prb_num_render_grid = max_ii(1, light_cache->grid_len);
709  sldata->common_data.prb_num_planar = pinfo->num_planar;
710 
711  if (pinfo->num_planar != pinfo->cache_num_planar) {
714  pinfo->cache_num_planar = pinfo->num_planar;
715  }
716  planar_pool_ensure_alloc(vedata, pinfo->num_planar);
717 
718  /* If light-cache auto-update is enable we tag the relevant part
719  * of the cache to update and fire up a baking job. */
721  (pinfo->do_grid_update || pinfo->do_cube_update)) {
722  BLI_assert(draw_ctx->evil_C);
723 
724  if (draw_ctx->scene->eevee.flag & SCE_EEVEE_GI_AUTOBAKE) {
725  Scene *scene_orig = DEG_get_input_scene(draw_ctx->depsgraph);
726  if (scene_orig->eevee.light_cache_data != NULL) {
727  if (pinfo->do_grid_update) {
729  }
730  /* If we update grid we need to update the cube-maps too.
731  * So always refresh cube-maps. */
733  /* Tag the lightcache to auto update. */
735  /* Use a notifier to trigger the operator after drawing. */
736  WM_event_add_notifier(draw_ctx->evil_C, NC_LIGHTPROBE, scene_orig);
737  }
738  }
739  }
740 
741  if (pinfo->num_planar > 0) {
742  EEVEE_PassList *psl = vedata->psl;
743  EEVEE_TextureList *txl = vedata->txl;
745 
748 
749  DRW_shgroup_uniform_texture_ref(grp, "source", &txl->planar_pool);
750  DRW_shgroup_uniform_float(grp, "fireflyFactor", &sldata->common_data.ssr_firefly_fac, 1);
752  }
753 }
754 
755 /* -------------------------------------------------------------------- */
759 typedef struct EEVEE_BakeRenderData {
762  struct GPUFrameBuffer **face_fb; /* should contain 6 framebuffer */
764 
765 static void render_cubemap(void (*callback)(int face, EEVEE_BakeRenderData *user_data),
767  const float pos[3],
768  float near,
769  float far,
770  bool do_culling)
771 {
772  EEVEE_StorageList *stl = user_data->vedata->stl;
773  DRWView **views = do_culling ? stl->g_data->bake_views : stl->g_data->world_views;
774 
775  float winmat[4][4], viewmat[4][4];
776  perspective_m4(winmat, -near, near, -near, near, near, far);
777 
778  /* Prepare views at the same time for faster culling. */
779  for (int i = 0; i < 6; i++) {
780  unit_m4(viewmat);
781  negate_v3_v3(viewmat[3], pos);
782  mul_m4_m4m4(viewmat, cubefacemat[i], viewmat);
783 
784  if (do_culling) {
785  if (views[i] == NULL) {
786  views[i] = DRW_view_create(viewmat, winmat, NULL, NULL, NULL);
787  }
788  else {
789  DRW_view_update(views[i], viewmat, winmat, NULL, NULL);
790  }
791  }
792  else {
793  if (views[i] == NULL) {
794  const DRWView *default_view = DRW_view_default_get();
795  views[i] = DRW_view_create_sub(default_view, viewmat, winmat);
796  }
797  else {
798  DRW_view_update_sub(views[i], viewmat, winmat);
799  }
800  }
801  }
802 
803  for (int i = 0; i < 6; i++) {
804  DRW_view_set_active(views[i]);
805  callback(i, user_data);
806  }
807 }
808 
811  EEVEE_PlanarReflection *planar_data,
812  int ref_count)
813 {
814  EEVEE_StorageList *stl = user_data->vedata->stl;
815  DRWView *main_view = stl->effects->taa_view;
816  DRWView **views = stl->g_data->planar_views;
817  /* Prepare views at the same time for faster culling. */
818  for (int i = 0; i < ref_count; i++) {
819  lightbake_planar_ensure_view(&planar_data[i], main_view, &views[i]);
820  }
821 
822  for (int i = 0; i < ref_count; i++) {
823  DRW_view_set_active(views[i]);
824  callback(i, user_data);
825  }
826 }
827 
829 {
830  EEVEE_PassList *psl = user_data->vedata->psl;
831  struct GPUFrameBuffer **face_fb = user_data->face_fb;
832 
833  /* For world probe, we don't need to clear the color buffer
834  * since we render the background directly. */
835  GPU_framebuffer_bind(face_fb[face]);
836  GPU_framebuffer_clear_depth(face_fb[face], 1.0f);
838 }
839 
841  EEVEE_Data *vedata,
842  struct GPUFrameBuffer *face_fb[6])
843 {
844  EEVEE_BakeRenderData brdata = {
845  .vedata = vedata,
846  .face_fb = face_fb,
847  };
848 
849  render_cubemap(lightbake_render_world_face, &brdata, (float[3]){0.0f}, 1.0f, 10.0f, false);
850 }
851 
853 {
854  EEVEE_ViewLayerData *sldata = user_data->sldata;
855  EEVEE_PassList *psl = user_data->vedata->psl;
856  EEVEE_PrivateData *g_data = user_data->vedata->stl->g_data;
857  DRWView **views = g_data->bake_views;
858 
859  struct GPUFrameBuffer **face_fb = user_data->face_fb;
860 
861  /* Be sure that cascaded shadow maps are updated. */
862  EEVEE_shadows_draw(sldata, user_data->vedata, views[face]);
863 
864  GPU_framebuffer_bind(face_fb[face]);
865  GPU_framebuffer_clear_depth(face_fb[face], 1.0f);
866 
867  DRW_draw_pass(psl->depth_ps);
870  DRW_draw_pass(psl->material_sss_ps); /* Only output standard pass */
872 }
873 
874 /* Render the scene to the probe_rt texture. */
876  EEVEE_Data *vedata,
877  struct GPUFrameBuffer *face_fb[6],
878  const float pos[3],
879  float near_clip,
880  float far_clip)
881 {
882  EEVEE_BakeRenderData brdata = {
883  .vedata = vedata,
884  .sldata = sldata,
885  .face_fb = face_fb,
886  };
887 
888  render_cubemap(lightbake_render_scene_face, &brdata, pos, near_clip, far_clip, true);
889 }
890 
892 {
893  EEVEE_Data *vedata = user_data->vedata;
894  EEVEE_ViewLayerData *sldata = user_data->sldata;
895  EEVEE_PassList *psl = vedata->psl;
896  EEVEE_TextureList *txl = vedata->txl;
897  EEVEE_StorageList *stl = vedata->stl;
898  EEVEE_FramebufferList *fbl = vedata->fbl;
899  EEVEE_LightProbesInfo *pinfo = sldata->probes;
900 
901  GPU_framebuffer_ensure_config(&fbl->planarref_fb,
902  {GPU_ATTACHMENT_TEXTURE_LAYER(txl->planar_depth, layer),
903  GPU_ATTACHMENT_TEXTURE_LAYER(txl->planar_pool, layer)});
904 
905  /* Use visibility info for this planar reflection. */
906  pinfo->vis_data = pinfo->planar_vis_tests[layer];
907 
908  /* Avoid using the texture attached to framebuffer when rendering. */
909  /* XXX */
910  GPUTexture *tmp_planar_pool = txl->planar_pool;
911  GPUTexture *tmp_planar_depth = txl->planar_depth;
912  txl->planar_pool = e_data.planar_pool_placeholder;
913  txl->planar_depth = e_data.depth_array_placeholder;
914 
915  DRW_stats_group_start("Planar Reflection");
916 
917  /* Be sure that cascaded shadow maps are updated. */
918  EEVEE_shadows_draw(sldata, vedata, stl->g_data->planar_views[layer]);
919 
921  GPU_framebuffer_clear_depth(fbl->planarref_fb, 1.0);
922 
923  float prev_background_alpha = vedata->stl->g_data->background_alpha;
924  vedata->stl->g_data->background_alpha = 1.0f;
925 
926  /* Slight modification: we handle refraction as normal
927  * shading and don't do SSRefraction. */
928 
931 
933  EEVEE_create_minmax_buffer(vedata, tmp_planar_depth, layer);
934  EEVEE_occlusion_compute(sldata, vedata);
935 
937 
938  /* Shading pass */
940  DRW_draw_pass(psl->material_sss_ps); /* Only output standard pass */
942 
943  /* Transparent */
945  /* Do the reordering only for offline because it can be costly. */
947  }
949 
951 
952  /* Restore */
953  txl->planar_pool = tmp_planar_pool;
954  txl->planar_depth = tmp_planar_depth;
955 
956  vedata->stl->g_data->background_alpha = prev_background_alpha;
957 }
958 
960  EEVEE_Data *vedata)
961 {
962  EEVEE_BakeRenderData brdata = {
963  .vedata = vedata,
964  .sldata = sldata,
965  };
966 
968  &brdata,
969  sldata->probes->planar_data,
970  sldata->probes->num_planar);
971 }
974 /* -------------------------------------------------------------------- */
978 /* Glossy filter rt_color to light_cache->cube_tx.tex at index probe_idx */
980  EEVEE_Data *vedata,
981  struct GPUTexture *rt_color,
982  struct GPUFrameBuffer *fb,
983  int probe_idx,
984  float intensity,
985  int maxlevel,
986  float filter_quality,
987  float firefly_fac)
988 {
989  EEVEE_PassList *psl = vedata->psl;
990  EEVEE_LightProbesInfo *pinfo = sldata->probes;
991  LightCache *light_cache = vedata->stl->g_data->light_cache;
992 
993  float target_size = (float)GPU_texture_width(rt_color);
994 
995  /* Max lod used from the render target probe */
996  pinfo->lod_rt_max = log2_floor_u(target_size) - 2.0f;
997  pinfo->intensity_fac = intensity;
998 
999  /* Start fresh */
1000  GPU_framebuffer_ensure_config(&fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_NONE});
1001 
1002  /* 2 - Let gpu create Mipmaps for Filtered Importance Sampling. */
1003  /* Bind next framebuffer to be able to gen. mips for probe_rt. */
1004  EEVEE_downsample_cube_buffer(vedata, rt_color, (int)(pinfo->lod_rt_max));
1005 
1006  /* 3 - Render to probe array to the specified layer, do prefiltering. */
1007  int mipsize = GPU_texture_width(light_cache->cube_tx.tex);
1008  for (int i = 0; i < maxlevel + 1; i++) {
1009  float bias = 0.0f;
1010  pinfo->texel_size = 1.0f / (float)mipsize;
1011  pinfo->padding_size = (i == maxlevel) ? 0 : (float)(1 << (maxlevel - i - 1));
1012  pinfo->padding_size *= pinfo->texel_size;
1013  pinfo->layer = probe_idx * 6;
1014  pinfo->roughness = i / (float)maxlevel;
1015  /* Disney Roughness */
1016  pinfo->roughness = square_f(pinfo->roughness);
1017  /* Distribute Roughness across lod more evenly */
1018  pinfo->roughness = square_f(pinfo->roughness);
1019  CLAMP(pinfo->roughness, 1e-4f, 0.9999f); /* Avoid artifacts */
1020 
1021 #if 1 /* Variable Sample count and bias (fast) */
1022  switch (i) {
1023  case 0:
1024  pinfo->samples_len = 1.0f;
1025  bias = -1.0f;
1026  break;
1027  case 1:
1028  pinfo->samples_len = 32.0f;
1029  bias = 1.0f;
1030  break;
1031  case 2:
1032  pinfo->samples_len = 40.0f;
1033  bias = 2.0f;
1034  break;
1035  case 3:
1036  pinfo->samples_len = 64.0f;
1037  bias = 2.0f;
1038  break;
1039  default:
1040  pinfo->samples_len = 128.0f;
1041  bias = 2.0f;
1042  break;
1043  }
1044 #else /* Constant Sample count (slow) */
1045  pinfo->samples_len = 1024.0f;
1046 #endif
1047  /* Cannot go higher than HAMMERSLEY_SIZE */
1048  CLAMP(filter_quality, 1.0f, 8.0f);
1049  pinfo->samples_len *= filter_quality;
1050 
1051  pinfo->lodfactor = bias + 0.5f * log(square_f(target_size) / pinfo->samples_len) / log(2);
1052  pinfo->firefly_fac = (firefly_fac > 0.0) ? firefly_fac : 1e16;
1053 
1054  GPU_framebuffer_ensure_config(&fb,
1055  {
1056  GPU_ATTACHMENT_NONE,
1057  GPU_ATTACHMENT_TEXTURE_MIP(light_cache->cube_tx.tex, i),
1058  });
1061 
1062  mipsize /= 2;
1063  CLAMP_MIN(mipsize, 1);
1064  }
1065 }
1066 
1067 /* Diffuse filter rt_color to light_cache->grid_tx.tex at index grid_offset */
1069  EEVEE_Data *vedata,
1070  struct GPUTexture *rt_color,
1071  struct GPUFrameBuffer *fb,
1072  int grid_offset,
1073  float intensity)
1074 {
1075  EEVEE_PassList *psl = vedata->psl;
1076  EEVEE_LightProbesInfo *pinfo = sldata->probes;
1077  LightCache *light_cache = vedata->stl->g_data->light_cache;
1078 
1079  float target_size = (float)GPU_texture_width(rt_color);
1080 
1081  pinfo->intensity_fac = intensity;
1082 
1083  /* find cell position on the virtual 3D texture */
1084  /* NOTE : Keep in sync with load_irradiance_cell() */
1085 #if defined(IRRADIANCE_SH_L2)
1086  int size[2] = {3, 3};
1087 #elif defined(IRRADIANCE_HL2)
1088  const int size[2] = {3, 2};
1089  pinfo->samples_len = 1024.0f;
1090 #endif
1091 
1092  int cell_per_row = GPU_texture_width(light_cache->grid_tx.tex) / size[0];
1093  int x = size[0] * (grid_offset % cell_per_row);
1094  int y = size[1] * (grid_offset / cell_per_row);
1095 
1096 #ifndef IRRADIANCE_SH_L2
1097  /* Tweaking parameters to balance perf. vs precision */
1098  const float bias = 0.0f;
1099  pinfo->lodfactor = bias + 0.5f * log(square_f(target_size) / pinfo->samples_len) / log(2);
1100  pinfo->lod_rt_max = log2_floor_u(target_size) - 2.0f;
1101 #else
1102  pinfo->shres = 32; /* Less texture fetches & reduce branches */
1103  pinfo->lod_rt_max = 2.0f; /* Improve cache reuse */
1104 #endif
1105 
1106  /* Start fresh */
1107  GPU_framebuffer_ensure_config(&fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_NONE});
1108 
1109  /* 4 - Compute diffuse irradiance */
1110  EEVEE_downsample_cube_buffer(vedata, rt_color, (int)(pinfo->lod_rt_max));
1111 
1112  GPU_framebuffer_ensure_config(
1113  &fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE_LAYER(light_cache->grid_tx.tex, 0)});
1118 }
1119 
1120 /* Filter rt_depth to light_cache->grid_tx.tex at index grid_offset */
1122  EEVEE_Data *vedata,
1123  struct GPUTexture *UNUSED(rt_depth),
1124  struct GPUFrameBuffer *fb,
1125  int grid_offset,
1126  float clipsta,
1127  float clipend,
1128  float vis_range,
1129  float vis_blur,
1130  int vis_size)
1131 {
1132  EEVEE_PassList *psl = vedata->psl;
1133  EEVEE_LightProbesInfo *pinfo = sldata->probes;
1134  LightCache *light_cache = vedata->stl->g_data->light_cache;
1135 
1136  pinfo->samples_len = 512.0f; /* TODO refine */
1137  pinfo->shres = vis_size;
1138  pinfo->visibility_range = vis_range;
1139  pinfo->visibility_blur = vis_blur;
1140  pinfo->near_clip = -clipsta;
1141  pinfo->far_clip = -clipend;
1142  pinfo->texel_size = 1.0f / (float)vis_size;
1143 
1144  int cell_per_col = GPU_texture_height(light_cache->grid_tx.tex) / vis_size;
1145  int cell_per_row = GPU_texture_width(light_cache->grid_tx.tex) / vis_size;
1146  int x = vis_size * (grid_offset % cell_per_row);
1147  int y = vis_size * ((grid_offset / cell_per_row) % cell_per_col);
1148  int layer = 1 + ((grid_offset / cell_per_row) / cell_per_col);
1149 
1150  GPU_framebuffer_ensure_config(
1151  &fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE_LAYER(light_cache->grid_tx.tex, layer)});
1153  GPU_framebuffer_viewport_set(fb, x, y, vis_size, vis_size);
1156 }
1157 
1158 /* Actually a simple down-sampling. */
1159 static void downsample_planar(void *vedata, int level)
1160 {
1161  EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
1162  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
1163 
1164  const float *size = DRW_viewport_size_get();
1166  for (int i = 0; i < level - 1; i++) {
1167  stl->g_data->planar_texel_size[0] /= 2.0f;
1168  stl->g_data->planar_texel_size[1] /= 2.0f;
1169  min_ff(floorf(stl->g_data->planar_texel_size[0]), 1.0f);
1170  min_ff(floorf(stl->g_data->planar_texel_size[1]), 1.0f);
1171  }
1173 
1175 }
1176 
1178 {
1179  EEVEE_TextureList *txl = vedata->txl;
1180  EEVEE_FramebufferList *fbl = vedata->fbl;
1181 
1182  DRW_stats_group_start("Planar Probe Downsample");
1183 
1184  GPU_framebuffer_ensure_config(&fbl->planar_downsample_fb,
1185  {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->planar_pool)});
1186 
1190 }
1191 
1195 {
1196  EEVEE_CommonUniformBuffer *common_data = &sldata->common_data;
1197  EEVEE_LightProbesInfo *pinfo = sldata->probes;
1198 
1199  if (pinfo->num_planar == 0) {
1200  /* Disable SSR if we cannot read previous frame */
1201  common_data->ssr_toggle = vedata->stl->g_data->valid_double_buffer;
1202  common_data->prb_num_planar = 0;
1203  return;
1204  }
1205 
1206  float hiz_uv_scale_prev[2] = {UNPACK2(common_data->hiz_uv_scale)};
1207 
1208  /* Temporary Remove all planar reflections (avoid lag effect). */
1209  common_data->prb_num_planar = 0;
1210  /* Turn off ssr to avoid black specular */
1211  common_data->ssr_toggle = false;
1212  common_data->ssrefract_toggle = false;
1213  common_data->sss_toggle = false;
1214 
1215  common_data->ray_type = EEVEE_RAY_GLOSSY;
1216  common_data->ray_depth = 1.0f;
1217  /* Planar reflections are rendered at the hiz resolution, so no need to scalling. */
1218  copy_v2_fl(common_data->hiz_uv_scale, 1.0f);
1219 
1220  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
1221 
1222  /* Rendering happens here! */
1224 
1225  /* Make sure no additional visibility check runs after this. */
1226  pinfo->vis_data.collection = NULL;
1227 
1228  GPU_uniformbuf_update(sldata->planar_ubo, &sldata->probes->planar_data);
1229 
1230  /* Restore */
1231  common_data->prb_num_planar = pinfo->num_planar;
1232  common_data->ssr_toggle = true;
1233  common_data->ssrefract_toggle = true;
1234  common_data->sss_toggle = true;
1235  copy_v2_v2(common_data->hiz_uv_scale, hiz_uv_scale_prev);
1236 
1237  /* Prefilter for SSR */
1238  if ((vedata->stl->effects->enabled_effects & EFFECT_SSR) != 0) {
1240  }
1241 
1242  if (DRW_state_is_image_render()) {
1243  /* Sort transparents because planar reflections could have re-sorted them. */
1245  }
1246 
1247  /* Disable SSR if we cannot read previous frame */
1248  common_data->ssr_toggle = vedata->stl->g_data->valid_double_buffer;
1249 }
1250 
1252 {
1253  const DRWContextState *draw_ctx = DRW_context_state_get();
1254  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
1255  LightCache *light_cache = vedata->stl->g_data->light_cache;
1256 
1257  if ((light_cache->flag & LIGHTCACHE_UPDATE_WORLD) &&
1258  (light_cache->flag & LIGHTCACHE_BAKED) == 0) {
1259  EEVEE_lightbake_update_world_quick(sldata, vedata, scene_eval);
1260  }
1261 }
1262 
1264 {
1265  MEM_SAFE_FREE(e_data.format_probe_display_planar);
1266  DRW_TEXTURE_FREE_SAFE(e_data.planar_pool_placeholder);
1267  DRW_TEXTURE_FREE_SAFE(e_data.depth_placeholder);
1268  DRW_TEXTURE_FREE_SAFE(e_data.depth_array_placeholder);
1269 }
typedef float(TangentPoint)[2]
bool BKE_collection_has_object_recursive(struct Collection *collection, struct Object *ob)
Definition: collection.c:961
General operations, lookup, etc. for blender objects.
void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], const float max[3])
Definition: object.c:3778
#define BLI_assert(a)
Definition: BLI_assert.h:58
MINLINE float max_fff(float a, float b, float c)
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
MINLINE float square_f(float a)
MINLINE unsigned int log2_floor_u(unsigned int x)
#define M_PI
Definition: BLI_math_base.h:38
void perspective_m4(float mat[4][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip)
Definition: math_geom.c:4830
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:262
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1187
void unit_m4(float m[4][4])
Definition: rct.c:1140
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1278
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:732
void scale_m4_fl(float R[4][4], float scale)
Definition: math_matrix.c:2309
void normalize_m4_m4(float R[4][4], const float M[4][4]) ATTR_NONNULL()
Definition: math_matrix.c:1972
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_fl(float r[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_v3_int(int r[3], const int a[3])
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE void invert_v2(float r[2])
MINLINE void copy_v2_fl(float r[2], float f)
Random number functions.
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define UNPACK2(a)
#define UNUSED(x)
#define CLAMP_MIN(a, b)
struct Scene * DEG_get_input_scene(const Depsgraph *graph)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ LIGHTCACHE_UPDATE_WORLD
@ LIGHTCACHE_BAKED
@ LIGHTCACHE_UPDATE_AUTO
@ LIGHTCACHE_NOT_USABLE
@ LIGHTCACHE_UPDATE_GRID
@ LIGHTCACHE_UPDATE_CUBE
@ LIGHTPROBE_FLAG_INVERT_GROUP
@ LIGHTPROBE_FLAG_SHOW_DATA
@ LIGHTPROBE_FLAG_CUSTOM_PARALLAX
@ LIGHTPROBE_TYPE_CUBE
@ LIGHTPROBE_TYPE_PLANAR
@ LIGHTPROBE_TYPE_GRID
@ SCE_EEVEE_SHOW_IRRADIANCE
@ SCE_EEVEE_SHOW_CUBEMAPS
@ SCE_EEVEE_GI_AUTOBAKE
#define DRW_shgroup_instance_format(format,...)
Definition: DRW_render.h:391
@ DRW_TEX_MIPMAP
Definition: DRW_render.h:142
@ DRW_TEX_FILTER
Definition: DRW_render.h:139
#define DRW_buffer_add_entry(buffer,...)
Definition: DRW_render.h:468
DRWState
Definition: DRW_render.h:312
@ DRW_STATE_DEPTH_EQUAL
Definition: DRW_render.h:324
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:314
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:323
@ DRW_STATE_CULL_BACK
Definition: DRW_render.h:328
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:593
#define DRW_shgroup_call(shgroup, geom, ob)
Definition: DRW_render.h:420
#define DRW_TEXTURE_FREE_SAFE(tex)
Definition: DRW_render.h:180
GPUBatch
Definition: GPU_batch.h:93
struct GPUFrameBuffer GPUFrameBuffer
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
int GPU_texture_height(const GPUTexture *tex)
Definition: gpu_texture.cc:532
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
int GPU_texture_width(const GPUTexture *tex)
Definition: gpu_texture.cc:527
@ GPU_DEPTH_COMPONENT24
Definition: GPU_texture.h:167
@ GPU_R11F_G11F_B10F
Definition: GPU_texture.h:119
@ GPU_RGBA8
Definition: GPU_texture.h:88
#define GPU_uniformbuf_create(size)
void GPU_uniformbuf_update(GPUUniformBuf *ubo, const void *data)
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
Group RGB to Bright Vector Camera CLAMP
#define NC_LIGHTPROBE
Definition: WM_types.h:303
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
CCL_NAMESPACE_BEGIN struct Options options
Scene scene
World world
void * user_data
DEGForeachIDComponentCallback callback
GPUBatch * DRW_cache_quad_get(void)
Definition: draw_cache.c:392
GPUBatch * DRW_cache_fullscreen_quad_get(void)
Definition: draw_cache.c:358
bool DRW_state_is_opengl_render(void)
bool DRW_state_draw_support(void)
const DRWContextState * DRW_context_state_get(void)
const float * DRW_viewport_size_get(void)
Definition: draw_manager.c:439
const float * DRW_viewport_screenvecs_get(void)
Definition: draw_manager.c:449
bool DRW_state_is_image_render(void)
DRWShadingGroup * DRW_shgroup_material_create(struct GPUMaterial *material, DRWPass *pass)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo)
void DRW_view_persmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
const DRWView * DRW_view_default_get(void)
void DRW_shgroup_call_instances(DRWShadingGroup *shgroup, Object *ob, struct GPUBatch *geom, uint count)
void DRW_shgroup_uniform_block_ref(DRWShadingGroup *shgroup, const char *name, GPUUniformBuf **ubo)
void DRW_shgroup_uniform_vec3(DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
DRWCallBuffer * DRW_shgroup_call_buffer_instance(DRWShadingGroup *shgroup, struct GPUVertFormat *format, GPUBatch *geom)
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, Object *ob, uint tri_count)
void DRW_shgroup_uniform_ivec3(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_pass_sort_shgroup_z(DRWPass *pass)
DRWView * DRW_view_create(const float viewmat[4][4], const float winmat[4][4], const float(*culling_viewmat)[4], const float(*culling_winmat)[4], DRWCallVisibilityFn *visibility_fn)
DRWView * DRW_view_create_sub(const DRWView *parent_view, const float viewmat[4][4], const float winmat[4][4])
void DRW_view_update(DRWView *view, const float viewmat[4][4], const float winmat[4][4], const float(*culling_viewmat)[4], const float(*culling_winmat)[4])
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_int(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
void DRW_view_clip_planes_set(DRWView *view, float(*planes)[4], int plane_len)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
void DRW_shgroup_uniform_float(DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
void DRW_view_update_sub(DRWView *view, const float viewmat[4][4], const float winmat[4][4])
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_view_set_active(DRWView *view)
void DRW_draw_pass(DRWPass *pass)
bool DRW_culling_box_test(const DRWView *view, const BoundBox *bbox)
void DRW_stats_group_start(const char *name)
void DRW_stats_group_end(void)
GPUTexture * DRW_texture_create_2d_array(int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
EEVEE_LightProbeEngineData * EEVEE_lightprobe_data_ensure(Object *ob)
Definition: eevee_data.c:333
void EEVEE_create_minmax_buffer(EEVEE_Data *vedata, GPUTexture *depth_src, int layer)
void EEVEE_downsample_cube_buffer(EEVEE_Data *vedata, GPUTexture *texture_src, int level)
LightCache * EEVEE_lightcache_create(const int grid_len, const int cube_len, const int cube_size, const int vis_size, const int irr_size[3])
bool EEVEE_lightcache_load(LightCache *lcache)
void EEVEE_lightbake_update_world_quick(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, const Scene *scene)
static void lightbake_render_scene_reflected(int layer, EEVEE_BakeRenderData *user_data)
void EEVEE_lightprobes_free(void)
void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, GPUTexture *rt_color, GPUTexture *rt_depth)
static void render_cubemap(void(*callback)(int face, EEVEE_BakeRenderData *user_data), EEVEE_BakeRenderData *user_data, const float pos[3], float near, float far, bool do_culling)
struct EEVEE_BakeRenderData EEVEE_BakeRenderData
void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *eprobe)
void EEVEE_lightbake_render_world(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata, struct GPUFrameBuffer *face_fb[6])
bool EEVEE_lightprobes_obj_visibility_cb(bool vis_in, void *user_data)
void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lightprobes_planar_data_from_object(Object *ob, EEVEE_PlanarReflection *eplanar, EEVEE_LightProbeVisTest *vis_test)
void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
static struct @193 e_data
static bool eevee_lightprobes_culling_test(Object *ob)
struct GPUVertFormat * format_probe_display_planar
struct GPUTexture * planar_pool_placeholder
static void render_reflections(void(*callback)(int face, EEVEE_BakeRenderData *user_data), EEVEE_BakeRenderData *user_data, EEVEE_PlanarReflection *planar_data, int ref_count)
static void eevee_lightprobes_extract_from_cache(EEVEE_LightProbesInfo *pinfo, LightCache *lcache)
void EEVEE_lightprobes_grid_data_from_object(Object *ob, EEVEE_LightGrid *egrid, int *offset)
static void EEVEE_lightbake_filter_planar(EEVEE_Data *vedata)
void EEVEE_lightbake_render_scene(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct GPUFrameBuffer *face_fb[6], const float pos[3], float near_clip, float far_clip)
static void lightbake_render_scene_face(int face, EEVEE_BakeRenderData *user_data)
void EEVEE_lightbake_filter_diffuse(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct GPUTexture *rt_color, struct GPUFrameBuffer *fb, int grid_offset, float intensity)
void EEVEE_lightprobes_cache_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object *ob)
void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
struct GPUTexture * depth_placeholder
static void lightbake_planar_ensure_view(EEVEE_PlanarReflection *eplanar, const DRWView *main_view, DRWView **r_planar_view)
static void downsample_planar(void *vedata, int level)
void EEVEE_lightbake_filter_visibility(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct GPUTexture *UNUSED(rt_depth), struct GPUFrameBuffer *fb, int grid_offset, float clipsta, float clipend, float vis_range, float vis_blur, int vis_size)
static void lightbake_render_world_face(int face, EEVEE_BakeRenderData *user_data)
static void planar_pool_ensure_alloc(EEVEE_Data *vedata, int num_planar_ref)
void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct GPUTexture *rt_color, struct GPUFrameBuffer *fb, int probe_idx, float intensity, int maxlevel, float filter_quality, float firefly_fac)
static void eevee_lightbake_render_scene_to_planars(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
struct GPUTexture * depth_array_placeholder
void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata, DRWPass *pass, EEVEE_LightProbesInfo *pinfo, DRWShadingGroup **r_shgrp)
void EEVEE_occlusion_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
struct GPUShader * EEVEE_shaders_probe_planar_display_sh_get(void)
@ VAR_WORLD_BACKGROUND
@ VAR_WORLD_PROBE
#define MAX_SCREEN_BUFFERS_LOD_LEVEL
struct GPUShader * EEVEE_shaders_probe_grid_fill_sh_get(void)
#define LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d)
World * EEVEE_world_default_get(void)
struct GPUShader * EEVEE_shaders_probe_filter_visibility_sh_get(void)
#define EEVEE_PROBE_MAX
Definition: eevee_private.h:88
struct GPUShader * EEVEE_shaders_probe_filter_diffuse_sh_get(void)
#define EEVEE_RAY_GLOSSY
struct GPUShader * EEVEE_shaders_probe_cube_display_sh_get(void)
#define MAX_PLANAR
Definition: eevee_private.h:49
#define MAX_PROBE
Definition: eevee_private.h:47
struct GPUShader * EEVEE_shaders_probe_planar_downsample_sh_get(void)
@ EFFECT_SSR
static const float cubefacemat[6][4][4]
#define MAX_GRID
Definition: eevee_private.h:48
void EEVEE_shadows_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct DRWView *view)
struct GPUMaterial * EEVEE_material_get(EEVEE_Data *vedata, struct Scene *scene, Material *ma, World *wo, int options)
struct GPUShader * EEVEE_shaders_probe_filter_glossy_sh_get(void)
struct GPUShader * EEVEE_shaders_probe_grid_display_sh_get(void)
void EEVEE_shaders_material_shaders_init(void)
uint pos
void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb, int max_lvl, void(*callback)(void *userData, int level), void *userData)
void GPU_framebuffer_viewport_reset(GPUFrameBuffer *gpu_fb)
void GPU_framebuffer_viewport_set(GPUFrameBuffer *gpu_fb, int x, int y, int width, int height)
BLI_INLINE float fb(float length, float L)
#define cosf(x)
#define floorf(x)
#define sqrtf(x)
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static ulong state[N]
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:303
#define min(a, b)
Definition: sort.c:51
float vec[8][3]
struct Scene * scene
Definition: DRW_render.h:745
const struct bContext * evil_C
Definition: DRW_render.h:763
struct Depsgraph * depsgraph
Definition: DRW_render.h:753
struct View3D * v3d
Definition: DRW_render.h:742
EEVEE_ViewLayerData * sldata
struct GPUFrameBuffer ** face_fb
EEVEE_TextureList * txl
EEVEE_StorageList * stl
char info[GPU_INFO_SIZE]
EEVEE_PassList * psl
EEVEE_FramebufferList * fbl
EEVEE_EffectsFlag enabled_effects
struct DRWView * taa_view
struct GPUFrameBuffer * planar_downsample_fb
struct GPUFrameBuffer * planarref_fb
struct Collection * collection
EEVEE_LightProbeVisTest vis_data
EEVEE_LightProbeVisTest planar_vis_tests[MAX_PLANAR]
EEVEE_LightGrid grid_data[MAX_GRID]
EEVEE_LightProbe probe_data[MAX_PROBE]
EEVEE_PlanarReflection planar_data[MAX_PLANAR]
EEVEE_LightProbeVisTest * test_data
struct DRWPass * material_sss_ps
struct DRWPass * probe_planar_downsample_ps
struct DRWPass * transparent_pass
struct DRWPass * depth_clip_ps
struct DRWPass * depth_ps
struct DRWPass * material_refract_ps
struct DRWPass * probe_background
struct DRWPass * probe_diffuse_compute
struct DRWPass * material_ps
struct DRWPass * depth_refract_clip_ps
struct DRWPass * probe_display
struct DRWPass * probe_glossy_compute
struct DRWPass * probe_grid_fill
struct DRWPass * probe_visibility_compute
float planar_texel_size[2]
struct DRWView * bake_views[6]
struct GPUUniformBuf * renderpass_ubo
struct DRWView * cube_views[6]
struct DRWView * world_views[6]
struct LightCache * light_cache
struct DRWView * planar_views[MAX_PLANAR]
struct DRWCallBuffer * planar_display_shgrp
struct EEVEE_PrivateData * g_data
struct EEVEE_EffectsInfo * effects
struct GPUTexture * planar_depth
struct GPUTexture * planar_pool
struct EEVEE_CommonUniformBuffer common_data
struct GPUUniformBuf * combined
struct GPUUniformBuf * shadow_ubo
struct GPUUniformBuf * probe_ubo
struct GPUUniformBuf * grid_ubo
struct GPUUniformBuf * planar_ubo
struct EEVEE_ViewLayerData::@202 renderpass_ubo
struct LightCache * fallback_lightcache
struct GPUUniformBuf * common_ubo
struct GPUUniformBuf * light_ubo
struct EEVEE_LightProbesInfo * probes
struct GPUTexture * tex
LightGridCache * grid_data
LightProbeCache * cube_data
LightCacheTexture grid_tx
LightCacheTexture cube_tx
float attenuationmat[4][4]
struct Collection * visibility_grp
float obmat[4][4]
void * data
float gi_irradiance_smoothing
struct LightCache * light_cache_data
int gi_visibility_resolution
float gi_irradiance_draw_size
float gi_cubemap_draw_size
int gi_cubemap_resolution
struct World * world
struct SceneEEVEE eevee
float max
void WM_event_add_notifier(const bContext *C, uint type, void *reference)