Blender  V3.3
eevee_lightprobes.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 Blender Foundation. */
3 
8 #include "DRW_render.h"
9 
10 #include "BLI_rand.h"
11 #include "BLI_string_utils.h"
12 #include "BLI_utildefines.h"
13 
14 #include "DNA_image_types.h"
15 #include "DNA_lightprobe_types.h"
16 #include "DNA_texture_types.h"
17 #include "DNA_view3d_types.h"
18 #include "DNA_world_types.h"
19 
20 #include "BKE_collection.h"
21 #include "BKE_object.h"
22 #include "MEM_guardedalloc.h"
23 
24 #include "GPU_capabilities.h"
25 #include "GPU_material.h"
26 #include "GPU_texture.h"
27 #include "GPU_uniform_buffer.h"
28 
29 #include "DEG_depsgraph_query.h"
30 
31 #include "eevee_lightcache.h"
32 #include "eevee_private.h"
33 
34 #include "WM_api.h"
35 #include "WM_types.h"
36 
37 static struct {
41 
43 } e_data = {NULL}; /* Engine data */
44 
45 /* *********** FUNCTIONS *********** */
46 
47 /* TODO: find a better way than this. This does not support dupli objects if
48  * the original object is hidden. */
50 {
52 
53  /* test disabled if group is NULL */
54  if (oed == NULL || oed->test_data->collection == NULL) {
55  return vis_in;
56  }
57 
58  if (oed->test_data->cached == false) {
59  oed->ob_vis_dirty = true;
60  }
61 
62  /* early out, don't need to compute ob_vis yet. */
63  if (vis_in == false) {
64  return vis_in;
65  }
66 
67  if (oed->ob_vis_dirty) {
68  oed->ob_vis_dirty = false;
70  oed->ob_vis = (oed->test_data->invert) ? !oed->ob_vis : oed->ob_vis;
71  }
72 
73  return vis_in && oed->ob_vis;
74 }
75 
76 static void planar_pool_ensure_alloc(EEVEE_Data *vedata, int num_planar_ref)
77 {
78  EEVEE_TextureList *txl = vedata->txl;
79  EEVEE_StorageList *stl = vedata->stl;
80  EEVEE_EffectsInfo *fx = stl->effects;
81 
82  /* XXX TODO: OPTIMIZATION: This is a complete waist of texture memory.
83  * Instead of allocating each planar probe for each viewport,
84  * only alloc them once using the biggest viewport resolution. */
85 
86  /* TODO: get screen percentage from layer setting. */
87  // const DRWContextState *draw_ctx = DRW_context_state_get();
88  // ViewLayer *view_layer = draw_ctx->view_layer;
89  int screen_divider = 1;
90 
91  int width = max_ii(1, fx->hiz_size[0] / screen_divider);
92  int height = max_ii(1, fx->hiz_size[1] / screen_divider);
93 
94  /* Fix case were the pool was allocated width the dummy size (1,1,1). */
95  if (txl->planar_pool && (num_planar_ref > 0) &&
100  }
101 
102  /* We need an Array texture so allocate it ourself */
103  if (!txl->planar_pool) {
104  if (num_planar_ref > 0) {
106  height,
107  num_planar_ref,
110  NULL);
112  width, height, num_planar_ref, GPU_DEPTH_COMPONENT24, 0, NULL);
113  }
114  else if (num_planar_ref == 0) {
115  /* Makes Opengl Happy : Create a placeholder texture that will never be sampled but still
116  * bound to shader. */
120  }
121  }
122 }
123 
125 {
126  EEVEE_CommonUniformBuffer *common_data = &sldata->common_data;
127  EEVEE_StorageList *stl = vedata->stl;
128 
129  const DRWContextState *draw_ctx = DRW_context_state_get();
130  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
131  vedata->info[0] = '\0';
132 
134 
135  memset(stl->g_data->bake_views, 0, sizeof(stl->g_data->bake_views));
136  memset(stl->g_data->cube_views, 0, sizeof(stl->g_data->cube_views));
137  memset(stl->g_data->world_views, 0, sizeof(stl->g_data->world_views));
138  memset(stl->g_data->planar_views, 0, sizeof(stl->g_data->planar_views));
139 
140  if (EEVEE_lightcache_load(scene_eval->eevee.light_cache_data)) {
141  stl->g_data->light_cache = scene_eval->eevee.light_cache_data;
142  }
143  else {
144  if (scene_eval->eevee.light_cache_data &&
146  /* Error message info. */
147  BLI_snprintf(
148  vedata->info, sizeof(vedata->info), "Error: LightCache cannot be loaded on this GPU");
149  }
150 
151  if (!sldata->fallback_lightcache) {
152 #if defined(IRRADIANCE_SH_L2)
153  int grid_res = 4;
154 #elif defined(IRRADIANCE_HL2)
155  int grid_res = 4;
156 #endif
158  1,
159  1,
160  scene_eval->eevee.gi_cubemap_resolution,
161  scene_eval->eevee.gi_visibility_resolution,
162  (int[3]){grid_res, grid_res, 1});
163  }
164  stl->g_data->light_cache = sldata->fallback_lightcache;
165  }
166 
167  if (!sldata->probes) {
168  sldata->probes = MEM_callocN(sizeof(EEVEE_LightProbesInfo), "EEVEE_LightProbesInfo");
172  }
173 
174  common_data->prb_num_planar = 0;
175  common_data->prb_num_render_cube = 1;
176  common_data->prb_num_render_grid = 1;
177 
178  common_data->spec_toggle = true;
179  common_data->ssr_toggle = true;
180  common_data->ssrefract_toggle = true;
181  common_data->sss_toggle = true;
182 
183  /* Placeholder planar pool: used when rendering planar reflections (avoid dependency loop). */
184  if (!e_data.planar_pool_placeholder) {
185  e_data.planar_pool_placeholder = DRW_texture_create_2d_array(
186  1, 1, 1, GPU_RGBA8, DRW_TEX_FILTER, NULL);
187  }
188 }
189 
191  EEVEE_Data *vedata,
192  GPUTexture *rt_color,
193  GPUTexture *rt_depth)
194 {
195  EEVEE_PassList *psl = vedata->psl;
196  LightCache *light_cache = vedata->stl->g_data->light_cache;
197  EEVEE_LightProbesInfo *pinfo = sldata->probes;
198 
199  {
201 
203  psl->probe_glossy_compute);
204 
205  DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1);
206  DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
207  DRW_shgroup_uniform_float(grp, "probe_roughness", &pinfo->roughness, 1);
208  DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
209  DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
210  DRW_shgroup_uniform_float(grp, "texelSize", &pinfo->texel_size, 1);
211  DRW_shgroup_uniform_float(grp, "paddingSize", &pinfo->padding_size, 1);
212  DRW_shgroup_uniform_float(grp, "fireflyFactor", &pinfo->firefly_fac, 1);
213  DRW_shgroup_uniform_int(grp, "Layer", &pinfo->layer, 1);
214  // DRW_shgroup_uniform_texture(grp, "texJitter", e_data.jitter);
215  DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color);
216  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
217  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
218 
219  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
220  DRW_shgroup_call_instances(grp, NULL, geom, 6);
221  }
222 
223  {
226  psl->probe_diffuse_compute);
227 #ifdef IRRADIANCE_SH_L2
228  DRW_shgroup_uniform_int(grp, "probeSize", &pinfo->shres, 1);
229 #else
230  DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
231  DRW_shgroup_uniform_float(grp, "lodFactor", &pinfo->lodfactor, 1);
232  DRW_shgroup_uniform_float(grp, "lodMax", &pinfo->lod_rt_max, 1);
233 #endif
234  DRW_shgroup_uniform_float(grp, "intensityFac", &pinfo->intensity_fac, 1);
235  DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color);
236  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
237  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
238 
239  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
240  DRW_shgroup_call(grp, geom, NULL);
241  }
242 
243  {
247  DRW_shgroup_uniform_int(grp, "outputSize", &pinfo->shres, 1);
248  DRW_shgroup_uniform_float(grp, "visibilityRange", &pinfo->visibility_range, 1);
249  DRW_shgroup_uniform_float(grp, "visibilityBlur", &pinfo->visibility_blur, 1);
250  DRW_shgroup_uniform_float(grp, "sampleCount", &pinfo->samples_len, 1);
251  DRW_shgroup_uniform_float(grp, "storedTexelSize", &pinfo->texel_size, 1);
252  DRW_shgroup_uniform_float(grp, "nearClip", &pinfo->near_clip, 1);
253  DRW_shgroup_uniform_float(grp, "farClip", &pinfo->far_clip, 1);
254  DRW_shgroup_uniform_texture(grp, "probeDepth", rt_depth);
255  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
256  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
257 
258  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
259  DRW_shgroup_call(grp, geom, NULL);
260  }
261 
262  {
264 
266  psl->probe_grid_fill);
267 
268  DRW_shgroup_uniform_texture_ref(grp, "irradianceGrid", &light_cache->grid_tx.tex);
269 
270  struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
271  DRW_shgroup_call(grp, geom, NULL);
272  }
273 }
274 
276 {
277  EEVEE_TextureList *txl = vedata->txl;
278  EEVEE_PassList *psl = vedata->psl;
279  EEVEE_StorageList *stl = vedata->stl;
280  EEVEE_LightProbesInfo *pinfo = sldata->probes;
281  LightCache *lcache = stl->g_data->light_cache;
282  const DRWContextState *draw_ctx = DRW_context_state_get();
283  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
284 
285  pinfo->num_planar = 0;
286  pinfo->vis_data.collection = NULL;
287  pinfo->do_grid_update = false;
288  pinfo->do_cube_update = false;
289 
290  {
292 
293  DRWShadingGroup *grp = NULL;
294  EEVEE_lookdev_cache_init(vedata, sldata, psl->probe_background, pinfo, &grp);
295 
296  if (grp == NULL) {
297  Scene *scene = draw_ctx->scene;
299 
301  struct GPUMaterial *gpumat = EEVEE_material_get(vedata, scene, NULL, world, options);
302 
303  grp = DRW_shgroup_material_create(gpumat, psl->probe_background);
304  DRW_shgroup_uniform_float_copy(grp, "backgroundAlpha", 1.0f);
305  }
306 
307  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
308  DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo);
309  DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo);
310  DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo);
311  DRW_shgroup_uniform_block(grp, "light_block", sldata->light_ubo);
312  DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo);
313  DRW_shgroup_uniform_block_ref(grp, "renderpass_block", &stl->g_data->renderpass_ubo);
315  }
316 
317  if (DRW_state_draw_support()) {
321 
322  if (!LOOK_DEV_STUDIO_LIGHT_ENABLED(draw_ctx->v3d)) {
323  /* Cube Display */
324  if (scene_eval->eevee.flag & SCE_EEVEE_SHOW_CUBEMAPS && lcache->cube_len > 1) {
325  int cube_len = lcache->cube_len - 1; /* don't count the world. */
327  psl->probe_display);
328 
329  DRW_shgroup_uniform_texture_ref(grp, "probeCubes", &lcache->cube_tx.tex);
330  DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo);
331  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
332  DRW_shgroup_uniform_vec3(grp, "screen_vecs", DRW_viewport_screenvecs_get(), 2);
334  grp, "sphere_size", scene_eval->eevee.gi_cubemap_draw_size * 0.5f);
335  /* TODO(fclem): get rid of those UBO. */
336  DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo);
337  DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo);
338  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
339 
340  DRW_shgroup_call_procedural_triangles(grp, NULL, cube_len * 2);
341  }
342 
343  /* Grid Display */
344  if (scene_eval->eevee.flag & SCE_EEVEE_SHOW_IRRADIANCE) {
345  EEVEE_LightGrid *egrid = lcache->grid_data + 1;
346  for (int p = 1; p < lcache->grid_len; p++, egrid++) {
348  psl->probe_display);
349 
350  DRW_shgroup_uniform_int(shgrp, "offset", &egrid->offset, 1);
351  DRW_shgroup_uniform_ivec3(shgrp, "grid_resolution", egrid->resolution, 1);
352  DRW_shgroup_uniform_vec3(shgrp, "corner", egrid->corner, 1);
353  DRW_shgroup_uniform_vec3(shgrp, "increment_x", egrid->increment_x, 1);
354  DRW_shgroup_uniform_vec3(shgrp, "increment_y", egrid->increment_y, 1);
355  DRW_shgroup_uniform_vec3(shgrp, "increment_z", egrid->increment_z, 1);
356  DRW_shgroup_uniform_vec3(shgrp, "screen_vecs", DRW_viewport_screenvecs_get(), 2);
357  DRW_shgroup_uniform_texture_ref(shgrp, "irradianceGrid", &lcache->grid_tx.tex);
359  shgrp, "sphere_size", scene_eval->eevee.gi_irradiance_draw_size * 0.5f);
360  /* TODO(fclem): get rid of those UBO. */
361  DRW_shgroup_uniform_block(shgrp, "probe_block", sldata->probe_ubo);
362  DRW_shgroup_uniform_block(shgrp, "planar_block", sldata->planar_ubo);
363  DRW_shgroup_uniform_block(shgrp, "grid_block", sldata->grid_ubo);
364  DRW_shgroup_uniform_block(shgrp, "common_block", sldata->common_ubo);
365  DRW_shgroup_uniform_block(shgrp, "renderpass_block", sldata->renderpass_ubo.combined);
366  int tri_count = egrid->resolution[0] * egrid->resolution[1] * egrid->resolution[2] * 2;
367  DRW_shgroup_call_procedural_triangles(shgrp, NULL, tri_count);
368  }
369  }
370  }
371 
372  /* Planar Display */
373  {
374  DRW_shgroup_instance_format(e_data.format_probe_display_planar,
375  {
376  {"probe_id", DRW_ATTR_INT, 1},
377  {"probe_mat", DRW_ATTR_FLOAT, 16},
378  });
379 
381  psl->probe_display);
382  DRW_shgroup_uniform_texture_ref(grp, "probePlanars", &txl->planar_pool);
383  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
384 
386  grp, e_data.format_probe_display_planar, DRW_cache_quad_get());
387  }
388  }
389  else {
390  stl->g_data->planar_display_shgrp = NULL;
391  }
392 }
393 
395 {
396  LightProbe *probe = (LightProbe *)ob->data;
397 
398  switch (probe->type) {
399  case LIGHTPROBE_TYPE_PLANAR: {
400  /* See if this planar probe is inside the view frustum. If not, no need to update it. */
401  /* NOTE: this could be bypassed if we want feedback loop mirrors for rendering. */
402  BoundBox bbox;
403  float tmp[4][4];
404  const float min[3] = {-1.0f, -1.0f, -1.0f};
405  const float max[3] = {1.0f, 1.0f, 1.0f};
407 
408  copy_m4_m4(tmp, ob->obmat);
409  normalize_v3(tmp[2]);
410  mul_v3_fl(tmp[2], probe->distinf);
411 
412  for (int v = 0; v < 8; v++) {
413  mul_m4_v3(tmp, bbox.vec[v]);
414  }
415  const DRWView *default_view = DRW_view_default_get();
416  return DRW_culling_box_test(default_view, &bbox);
417  }
419  return true; /* TODO */
421  return true; /* TODO */
422  }
423  BLI_assert(0);
424  return true;
425 }
426 
428 {
429  EEVEE_LightProbesInfo *pinfo = sldata->probes;
430  LightProbe *probe = (LightProbe *)ob->data;
431 
432  if ((probe->type == LIGHTPROBE_TYPE_CUBE && pinfo->num_cube >= EEVEE_PROBE_MAX) ||
433  (probe->type == LIGHTPROBE_TYPE_GRID && pinfo->num_grid >= EEVEE_PROBE_MAX) ||
434  (probe->type == LIGHTPROBE_TYPE_PLANAR && pinfo->num_planar >= MAX_PLANAR)) {
435  printf("Too many probes in the view !!!\n");
436  return;
437  }
438 
439  if (probe->type == LIGHTPROBE_TYPE_PLANAR) {
440  /* TODO(fclem): Culling should be done after cache generation.
441  * This is needed for future draw cache persistence. */
443  return; /* Culled */
444  }
446  ob, &pinfo->planar_data[pinfo->num_planar], &pinfo->planar_vis_tests[pinfo->num_planar]);
447  /* Debug Display */
448  DRWCallBuffer *grp = vedata->stl->g_data->planar_display_shgrp;
449  if (grp && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
450  DRW_buffer_add_entry(grp, &pinfo->num_planar, ob->obmat);
451  }
452 
453  pinfo->num_planar++;
454  }
455  else {
457  if (ped->need_update) {
458  if (probe->type == LIGHTPROBE_TYPE_GRID) {
459  pinfo->do_grid_update = true;
460  }
461  else {
462  pinfo->do_cube_update = true;
463  }
464  ped->need_update = false;
465  }
466  }
467 }
468 
470 {
471  LightProbe *probe = (LightProbe *)ob->data;
472 
474 
475  /* Save current offset and advance it for the next grid. */
476  egrid->offset = *offset;
477  *offset += egrid->resolution[0] * egrid->resolution[1] * egrid->resolution[2];
478 
479  /* Add one for level 0 */
480  float fac = 1.0f / max_ff(1e-8f, probe->falloff);
481  egrid->attenuation_scale = fac / max_ff(1e-8f, probe->distinf);
482  egrid->attenuation_bias = fac;
483 
484  /* Update transforms */
485  float cell_dim[3], half_cell_dim[3];
486  cell_dim[0] = 2.0f / egrid->resolution[0];
487  cell_dim[1] = 2.0f / egrid->resolution[1];
488  cell_dim[2] = 2.0f / egrid->resolution[2];
489 
490  mul_v3_v3fl(half_cell_dim, cell_dim, 0.5f);
491 
492  /* Matrix converting world space to cell ranges. */
493  invert_m4_m4(egrid->mat, ob->obmat);
494 
495  /* First cell. */
496  copy_v3_fl(egrid->corner, -1.0f);
497  add_v3_v3(egrid->corner, half_cell_dim);
498  mul_m4_v3(ob->obmat, egrid->corner);
499 
500  /* Opposite neighbor cell. */
501  copy_v3_fl3(egrid->increment_x, cell_dim[0], 0.0f, 0.0f);
502  add_v3_v3(egrid->increment_x, half_cell_dim);
503  add_v3_fl(egrid->increment_x, -1.0f);
504  mul_m4_v3(ob->obmat, egrid->increment_x);
505  sub_v3_v3(egrid->increment_x, egrid->corner);
506 
507  copy_v3_fl3(egrid->increment_y, 0.0f, cell_dim[1], 0.0f);
508  add_v3_v3(egrid->increment_y, half_cell_dim);
509  add_v3_fl(egrid->increment_y, -1.0f);
510  mul_m4_v3(ob->obmat, egrid->increment_y);
511  sub_v3_v3(egrid->increment_y, egrid->corner);
512 
513  copy_v3_fl3(egrid->increment_z, 0.0f, 0.0f, cell_dim[2]);
514  add_v3_v3(egrid->increment_z, half_cell_dim);
515  add_v3_fl(egrid->increment_z, -1.0f);
516  mul_m4_v3(ob->obmat, egrid->increment_z);
517  sub_v3_v3(egrid->increment_z, egrid->corner);
518 
519  /* Visibility bias */
520  egrid->visibility_bias = 0.05f * probe->vis_bias;
521  egrid->visibility_bleed = probe->vis_bleedbias;
522  egrid->visibility_range = 1.0f + sqrtf(max_fff(len_squared_v3(egrid->increment_x),
523  len_squared_v3(egrid->increment_y),
524  len_squared_v3(egrid->increment_z)));
525 }
526 
528 {
529  LightProbe *probe = (LightProbe *)ob->data;
530 
531  /* Update transforms */
532  copy_v3_v3(eprobe->position, ob->obmat[3]);
533 
534  /* Attenuation */
535  eprobe->attenuation_type = probe->attenuation_type;
536  eprobe->attenuation_fac = 1.0f / max_ff(1e-8f, probe->falloff);
537 
538  unit_m4(eprobe->attenuationmat);
539  scale_m4_fl(eprobe->attenuationmat, probe->distinf);
540  mul_m4_m4m4(eprobe->attenuationmat, ob->obmat, eprobe->attenuationmat);
541  invert_m4(eprobe->attenuationmat);
542 
543  /* Parallax */
544  unit_m4(eprobe->parallaxmat);
545 
546  if ((probe->flag & LIGHTPROBE_FLAG_CUSTOM_PARALLAX) != 0) {
547  eprobe->parallax_type = probe->parallax_type;
548  scale_m4_fl(eprobe->parallaxmat, probe->distpar);
549  }
550  else {
551  eprobe->parallax_type = probe->attenuation_type;
552  scale_m4_fl(eprobe->parallaxmat, probe->distinf);
553  }
554 
555  mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat);
556  invert_m4(eprobe->parallaxmat);
557 }
558 
560  EEVEE_PlanarReflection *eplanar,
561  EEVEE_LightProbeVisTest *vis_test)
562 {
563  LightProbe *probe = (LightProbe *)ob->data;
564  float normat[4][4], imat[4][4];
565 
566  vis_test->collection = probe->visibility_grp;
567  vis_test->invert = probe->flag & LIGHTPROBE_FLAG_INVERT_GROUP;
568  vis_test->cached = false;
569 
570  /* Computing mtx : matrix that mirror position around object's XY plane. */
571  normalize_m4_m4(normat, ob->obmat); /* object > world */
572  invert_m4_m4(imat, normat); /* world > object */
573  /* XY reflection plane */
574  imat[0][2] = -imat[0][2];
575  imat[1][2] = -imat[1][2];
576  imat[2][2] = -imat[2][2];
577  imat[3][2] = -imat[3][2]; /* world > object > mirrored obj */
578  mul_m4_m4m4(eplanar->mtx, normat, imat); /* world > object > mirrored obj > world */
579 
580  /* Compute clip plane equation / normal. */
581  copy_v3_v3(eplanar->plane_equation, ob->obmat[2]);
582  normalize_v3(eplanar->plane_equation); /* plane normal */
583  eplanar->plane_equation[3] = -dot_v3v3(eplanar->plane_equation, ob->obmat[3]);
584  eplanar->clipsta = probe->clipsta;
585 
586  /* Compute XY clip planes. */
587  normalize_v3_v3(eplanar->clip_vec_x, ob->obmat[0]);
588  normalize_v3_v3(eplanar->clip_vec_y, ob->obmat[1]);
589 
590  float vec[3] = {0.0f, 0.0f, 0.0f};
591  vec[0] = 1.0f;
592  vec[1] = 0.0f;
593  vec[2] = 0.0f;
594  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
595  eplanar->clip_edge_x_pos = dot_v3v3(eplanar->clip_vec_x, vec);
596 
597  vec[0] = 0.0f;
598  vec[1] = 1.0f;
599  vec[2] = 0.0f;
600  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
601  eplanar->clip_edge_y_pos = dot_v3v3(eplanar->clip_vec_y, vec);
602 
603  vec[0] = -1.0f;
604  vec[1] = 0.0f;
605  vec[2] = 0.0f;
606  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
607  eplanar->clip_edge_x_neg = dot_v3v3(eplanar->clip_vec_x, vec);
608 
609  vec[0] = 0.0f;
610  vec[1] = -1.0f;
611  vec[2] = 0.0f;
612  mul_m4_v3(ob->obmat, vec); /* Point on the edge */
613  eplanar->clip_edge_y_neg = dot_v3v3(eplanar->clip_vec_y, vec);
614 
615  /* Facing factors */
616  float max_angle = max_ff(1e-2f, 1.0f - probe->falloff) * M_PI_2;
617  float min_angle = 0.0f;
618  eplanar->facing_scale = 1.0f / max_ff(1e-8f, cosf(min_angle) - cosf(max_angle));
619  eplanar->facing_bias = -min_ff(1.0f - 1e-8f, cosf(max_angle)) * eplanar->facing_scale;
620 
621  /* Distance factors */
622  float max_dist = probe->distinf;
623  float min_dist = min_ff(1.0f - 1e-8f, 1.0f - probe->falloff) * probe->distinf;
624  eplanar->attenuation_scale = -1.0f / max_ff(1e-8f, max_dist - min_dist);
625  eplanar->attenuation_bias = max_dist * -eplanar->attenuation_scale;
626 }
627 
629  const DRWView *main_view,
630  DRWView **r_planar_view)
631 {
632  float winmat[4][4], viewmat[4][4], persmat[4][4];
633  DRW_view_viewmat_get(main_view, viewmat, false);
634  /* Temporal sampling jitter should be already applied to the DRW_MAT_WIN. */
635  DRW_view_winmat_get(main_view, winmat, false);
636  DRW_view_persmat_get(main_view, persmat, false);
637 
638  /* Invert X to avoid flipping the triangle facing direction. */
639  winmat[0][0] = -winmat[0][0];
640  winmat[1][0] = -winmat[1][0];
641  winmat[2][0] = -winmat[2][0];
642  winmat[3][0] = -winmat[3][0];
643  /* Reflect Camera Matrix. */
644  mul_m4_m4m4(viewmat, viewmat, eplanar->mtx);
645 
646  if (*r_planar_view == NULL) {
647  *r_planar_view = DRW_view_create(
648  viewmat, winmat, NULL, NULL, EEVEE_lightprobes_obj_visibility_cb);
649  /* Compute offset plane equation (fix missing texels near reflection plane). */
650  float clip_plane[4];
651  copy_v4_v4(clip_plane, eplanar->plane_equation);
652  clip_plane[3] += eplanar->clipsta;
653  /* Set clipping plane */
654  DRW_view_clip_planes_set(*r_planar_view, &clip_plane, 1);
655  }
656  else {
657  DRW_view_update(*r_planar_view, viewmat, winmat, NULL, NULL);
658  }
659 }
660 
662 {
663  /* copy the entire cache for now (up to MAX_PROBE) */
664  /* TODO: frustum cull to only add visible probes. */
665  memcpy(pinfo->probe_data,
666  lcache->cube_data,
667  sizeof(EEVEE_LightProbe) * max_ii(1, min_ii(lcache->cube_len, MAX_PROBE)));
668  /* TODO: compute the max number of grid based on sample count. */
669  memcpy(pinfo->grid_data,
670  lcache->grid_data,
671  sizeof(EEVEE_LightGrid) * max_ii(1, min_ii(lcache->grid_len, MAX_GRID)));
672 }
673 
675 {
676  EEVEE_StorageList *stl = vedata->stl;
677  LightCache *light_cache = stl->g_data->light_cache;
678  EEVEE_LightProbesInfo *pinfo = sldata->probes;
679  const DRWContextState *draw_ctx = DRW_context_state_get();
680  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
681 
682  eevee_lightprobes_extract_from_cache(sldata->probes, light_cache);
683 
684  GPU_uniformbuf_update(sldata->probe_ubo, &sldata->probes->probe_data);
685  GPU_uniformbuf_update(sldata->grid_ubo, &sldata->probes->grid_data);
686 
687  /* For shading, save max level of the octahedron map */
688  sldata->common_data.prb_lod_cube_max = (float)light_cache->mips_len;
689  sldata->common_data.prb_irradiance_vis_size = light_cache->vis_res;
691  sldata->common_data.prb_num_render_cube = max_ii(1, light_cache->cube_len);
692  sldata->common_data.prb_num_render_grid = max_ii(1, light_cache->grid_len);
693  sldata->common_data.prb_num_planar = pinfo->num_planar;
694 
695  if (pinfo->num_planar != pinfo->cache_num_planar) {
698  pinfo->cache_num_planar = pinfo->num_planar;
699  }
700  planar_pool_ensure_alloc(vedata, pinfo->num_planar);
701 
702  /* If light-cache auto-update is enable we tag the relevant part
703  * of the cache to update and fire up a baking job. */
705  (pinfo->do_grid_update || pinfo->do_cube_update)) {
706  BLI_assert(draw_ctx->evil_C);
707 
708  if (draw_ctx->scene->eevee.flag & SCE_EEVEE_GI_AUTOBAKE) {
709  Scene *scene_orig = DEG_get_input_scene(draw_ctx->depsgraph);
710  if (scene_orig->eevee.light_cache_data != NULL) {
711  if (pinfo->do_grid_update) {
713  }
714  /* If we update grid we need to update the cube-maps too.
715  * So always refresh cube-maps. */
717  /* Tag the lightcache to auto update. */
719  /* Use a notifier to trigger the operator after drawing. */
720  WM_event_add_notifier(draw_ctx->evil_C, NC_LIGHTPROBE, scene_orig);
721  }
722  }
723  }
724 
725  if (pinfo->num_planar > 0) {
726  EEVEE_PassList *psl = vedata->psl;
727  EEVEE_TextureList *txl = vedata->txl;
729 
732 
733  DRW_shgroup_uniform_texture_ref(grp, "source", &txl->planar_pool);
734  DRW_shgroup_uniform_float(grp, "fireflyFactor", &sldata->common_data.ssr_firefly_fac, 1);
736  }
737 }
738 
739 /* -------------------------------------------------------------------- */
743 typedef struct EEVEE_BakeRenderData {
746  struct GPUFrameBuffer **face_fb; /* should contain 6 framebuffer */
748 
749 static void render_cubemap(void (*callback)(int face, EEVEE_BakeRenderData *user_data),
751  const float pos[3],
752  float near,
753  float far,
754  bool do_culling)
755 {
756  EEVEE_StorageList *stl = user_data->vedata->stl;
757  DRWView **views = do_culling ? stl->g_data->bake_views : stl->g_data->world_views;
758 
759  float winmat[4][4], viewmat[4][4];
760  perspective_m4(winmat, -near, near, -near, near, near, far);
761 
762  /* Prepare views at the same time for faster culling. */
763  for (int i = 0; i < 6; i++) {
764  unit_m4(viewmat);
765  negate_v3_v3(viewmat[3], pos);
766  mul_m4_m4m4(viewmat, cubefacemat[i], viewmat);
767 
768  if (do_culling) {
769  if (views[i] == NULL) {
770  views[i] = DRW_view_create(viewmat, winmat, NULL, NULL, NULL);
771  }
772  else {
773  DRW_view_update(views[i], viewmat, winmat, NULL, NULL);
774  }
775  }
776  else {
777  if (views[i] == NULL) {
778  const DRWView *default_view = DRW_view_default_get();
779  views[i] = DRW_view_create_sub(default_view, viewmat, winmat);
780  }
781  else {
782  DRW_view_update_sub(views[i], viewmat, winmat);
783  }
784  }
785  }
786 
787  for (int i = 0; i < 6; i++) {
788  DRW_view_set_active(views[i]);
789  callback(i, user_data);
790  }
791 }
792 
795  EEVEE_PlanarReflection *planar_data,
796  int ref_count)
797 {
798  EEVEE_StorageList *stl = user_data->vedata->stl;
799  DRWView *main_view = stl->effects->taa_view;
800  DRWView **views = stl->g_data->planar_views;
801  /* Prepare views at the same time for faster culling. */
802  for (int i = 0; i < ref_count; i++) {
803  lightbake_planar_ensure_view(&planar_data[i], main_view, &views[i]);
804  }
805 
806  for (int i = 0; i < ref_count; i++) {
807  DRW_view_set_active(views[i]);
808  callback(i, user_data);
809  }
810 }
811 
813 {
814  EEVEE_PassList *psl = user_data->vedata->psl;
815  struct GPUFrameBuffer **face_fb = user_data->face_fb;
816 
817  /* For world probe, we don't need to clear the color buffer
818  * since we render the background directly. */
819  GPU_framebuffer_bind(face_fb[face]);
820  GPU_framebuffer_clear_depth(face_fb[face], 1.0f);
822 }
823 
825  EEVEE_Data *vedata,
826  struct GPUFrameBuffer *face_fb[6])
827 {
828  EEVEE_BakeRenderData brdata = {
829  .vedata = vedata,
830  .face_fb = face_fb,
831  };
832 
833  render_cubemap(lightbake_render_world_face, &brdata, (float[3]){0.0f}, 1.0f, 10.0f, false);
834 }
835 
837 {
838  EEVEE_ViewLayerData *sldata = user_data->sldata;
839  EEVEE_PassList *psl = user_data->vedata->psl;
840  EEVEE_PrivateData *g_data = user_data->vedata->stl->g_data;
841  DRWView **views = g_data->bake_views;
842 
843  struct GPUFrameBuffer **face_fb = user_data->face_fb;
844 
845  /* Be sure that cascaded shadow maps are updated. */
846  EEVEE_shadows_draw(sldata, user_data->vedata, views[face]);
847 
848  GPU_framebuffer_bind(face_fb[face]);
849  GPU_framebuffer_clear_depth(face_fb[face], 1.0f);
850 
851  DRW_draw_pass(psl->depth_ps);
854  DRW_draw_pass(psl->material_sss_ps); /* Only output standard pass */
856 }
857 
859  EEVEE_Data *vedata,
860  struct GPUFrameBuffer *face_fb[6],
861  const float pos[3],
862  float near_clip,
863  float far_clip)
864 {
865  EEVEE_BakeRenderData brdata = {
866  .vedata = vedata,
867  .sldata = sldata,
868  .face_fb = face_fb,
869  };
870 
871  render_cubemap(lightbake_render_scene_face, &brdata, pos, near_clip, far_clip, true);
872 }
873 
875 {
876  EEVEE_Data *vedata = user_data->vedata;
877  EEVEE_ViewLayerData *sldata = user_data->sldata;
878  EEVEE_PassList *psl = vedata->psl;
879  EEVEE_TextureList *txl = vedata->txl;
880  EEVEE_StorageList *stl = vedata->stl;
881  EEVEE_FramebufferList *fbl = vedata->fbl;
882  EEVEE_LightProbesInfo *pinfo = sldata->probes;
883 
884  GPU_framebuffer_ensure_config(&fbl->planarref_fb,
885  {GPU_ATTACHMENT_TEXTURE_LAYER(txl->planar_depth, layer),
886  GPU_ATTACHMENT_TEXTURE_LAYER(txl->planar_pool, layer)});
887 
888  /* Use visibility info for this planar reflection. */
889  pinfo->vis_data = pinfo->planar_vis_tests[layer];
890 
891  /* Avoid using the texture attached to framebuffer when rendering. */
892  /* XXX */
893  GPUTexture *tmp_planar_pool = txl->planar_pool;
894  GPUTexture *tmp_planar_depth = txl->planar_depth;
895  txl->planar_pool = e_data.planar_pool_placeholder;
896  txl->planar_depth = e_data.depth_array_placeholder;
897 
898  DRW_stats_group_start("Planar Reflection");
899 
900  /* Be sure that cascaded shadow maps are updated. */
901  EEVEE_shadows_draw(sldata, vedata, stl->g_data->planar_views[layer]);
902 
904  GPU_framebuffer_clear_depth(fbl->planarref_fb, 1.0);
905 
906  float prev_background_alpha = vedata->stl->g_data->background_alpha;
907  vedata->stl->g_data->background_alpha = 1.0f;
908 
909  /* Slight modification: we handle refraction as normal
910  * shading and don't do SSRefraction. */
911 
914 
916  EEVEE_create_minmax_buffer(vedata, tmp_planar_depth, layer);
917  EEVEE_occlusion_compute(sldata, vedata);
918 
920 
921  /* Shading pass */
923  DRW_draw_pass(psl->material_sss_ps); /* Only output standard pass */
925 
926  /* Transparent */
928  /* Do the reordering only for offline because it can be costly. */
930  }
932 
934 
935  /* Restore */
936  txl->planar_pool = tmp_planar_pool;
937  txl->planar_depth = tmp_planar_depth;
938 
939  vedata->stl->g_data->background_alpha = prev_background_alpha;
940 }
941 
943  EEVEE_Data *vedata)
944 {
945  EEVEE_BakeRenderData brdata = {
946  .vedata = vedata,
947  .sldata = sldata,
948  };
949 
951  &brdata,
952  sldata->probes->planar_data,
953  sldata->probes->num_planar);
954 }
955 
958 /* -------------------------------------------------------------------- */
963  EEVEE_Data *vedata,
964  struct GPUTexture *rt_color,
965  struct GPUFrameBuffer *fb,
966  int probe_idx,
967  float intensity,
968  int maxlevel,
969  float filter_quality,
970  float firefly_fac)
971 {
972  EEVEE_PassList *psl = vedata->psl;
973  EEVEE_LightProbesInfo *pinfo = sldata->probes;
974  LightCache *light_cache = vedata->stl->g_data->light_cache;
975 
976  float target_size = (float)GPU_texture_width(rt_color);
977 
978  /* Max lod used from the render target probe */
979  pinfo->lod_rt_max = log2_floor_u(target_size) - 2.0f;
980  pinfo->intensity_fac = intensity;
981 
982  /* Start fresh */
983  GPU_framebuffer_ensure_config(&fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_NONE});
984 
985  /* 2 - Let gpu create Mipmaps for Filtered Importance Sampling. */
986  /* Bind next framebuffer to be able to gen. mips for probe_rt. */
987  EEVEE_downsample_cube_buffer(vedata, rt_color, (int)(pinfo->lod_rt_max));
988 
989  /* 3 - Render to probe array to the specified layer, do prefiltering. */
990  int mipsize = GPU_texture_width(light_cache->cube_tx.tex);
991  for (int i = 0; i < maxlevel + 1; i++) {
992  float bias = 0.0f;
993  pinfo->texel_size = 1.0f / (float)mipsize;
994  pinfo->padding_size = (i == maxlevel) ? 0 : (float)(1 << (maxlevel - i - 1));
995  pinfo->padding_size *= pinfo->texel_size;
996  pinfo->layer = probe_idx * 6;
997  pinfo->roughness = i / (float)maxlevel;
998  /* Disney Roughness */
999  pinfo->roughness = square_f(pinfo->roughness);
1000  /* Distribute Roughness across lod more evenly */
1001  pinfo->roughness = square_f(pinfo->roughness);
1002  CLAMP(pinfo->roughness, 1e-4f, 0.9999f); /* Avoid artifacts */
1003 
1004 #if 1 /* Variable Sample count and bias (fast) */
1005  switch (i) {
1006  case 0:
1007  pinfo->samples_len = 1.0f;
1008  bias = -1.0f;
1009  break;
1010  case 1:
1011  pinfo->samples_len = 32.0f;
1012  bias = 1.0f;
1013  break;
1014  case 2:
1015  pinfo->samples_len = 40.0f;
1016  bias = 2.0f;
1017  break;
1018  case 3:
1019  pinfo->samples_len = 64.0f;
1020  bias = 2.0f;
1021  break;
1022  default:
1023  pinfo->samples_len = 128.0f;
1024  bias = 2.0f;
1025  break;
1026  }
1027 #else /* Constant Sample count (slow) */
1028  pinfo->samples_len = 1024.0f;
1029 #endif
1030  /* Cannot go higher than HAMMERSLEY_SIZE */
1031  CLAMP(filter_quality, 1.0f, 8.0f);
1032  pinfo->samples_len *= filter_quality;
1033 
1034  pinfo->lodfactor = bias + 0.5f * log(square_f(target_size) / pinfo->samples_len) / log(2);
1035  pinfo->firefly_fac = (firefly_fac > 0.0) ? firefly_fac : 1e16;
1036 
1037  GPU_framebuffer_ensure_config(&fb,
1038  {
1039  GPU_ATTACHMENT_NONE,
1040  GPU_ATTACHMENT_TEXTURE_MIP(light_cache->cube_tx.tex, i),
1041  });
1044 
1045  mipsize /= 2;
1046  CLAMP_MIN(mipsize, 1);
1047  }
1048 }
1049 
1051  EEVEE_Data *vedata,
1052  struct GPUTexture *rt_color,
1053  struct GPUFrameBuffer *fb,
1054  int grid_offset,
1055  float intensity)
1056 {
1057  EEVEE_PassList *psl = vedata->psl;
1058  EEVEE_LightProbesInfo *pinfo = sldata->probes;
1059  LightCache *light_cache = vedata->stl->g_data->light_cache;
1060 
1061  float target_size = (float)GPU_texture_width(rt_color);
1062 
1063  pinfo->intensity_fac = intensity;
1064 
1065  /* Find cell position on the virtual 3D texture. */
1066  /* NOTE: Keep in sync with `load_irradiance_cell()`. */
1067 #if defined(IRRADIANCE_SH_L2)
1068  int size[2] = {3, 3};
1069 #elif defined(IRRADIANCE_HL2)
1070  const int size[2] = {3, 2};
1071  pinfo->samples_len = 1024.0f;
1072 #endif
1073 
1074  int cell_per_row = GPU_texture_width(light_cache->grid_tx.tex) / size[0];
1075  int x = size[0] * (grid_offset % cell_per_row);
1076  int y = size[1] * (grid_offset / cell_per_row);
1077 
1078 #ifndef IRRADIANCE_SH_L2
1079  /* Tweaking parameters to balance perf. vs precision */
1080  const float bias = 0.0f;
1081  pinfo->lodfactor = bias + 0.5f * log(square_f(target_size) / pinfo->samples_len) / log(2);
1082  pinfo->lod_rt_max = log2_floor_u(target_size) - 2.0f;
1083 #else
1084  pinfo->shres = 32; /* Less texture fetches & reduce branches */
1085  pinfo->lod_rt_max = 2.0f; /* Improve cache reuse */
1086 #endif
1087 
1088  /* Start fresh */
1089  GPU_framebuffer_ensure_config(&fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_NONE});
1090 
1091  /* 4 - Compute diffuse irradiance */
1092  EEVEE_downsample_cube_buffer(vedata, rt_color, (int)(pinfo->lod_rt_max));
1093 
1094  GPU_framebuffer_ensure_config(
1095  &fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE_LAYER(light_cache->grid_tx.tex, 0)});
1100 }
1101 
1103  EEVEE_Data *vedata,
1104  struct GPUTexture *UNUSED(rt_depth),
1105  struct GPUFrameBuffer *fb,
1106  int grid_offset,
1107  float clipsta,
1108  float clipend,
1109  float vis_range,
1110  float vis_blur,
1111  int vis_size)
1112 {
1113  EEVEE_PassList *psl = vedata->psl;
1114  EEVEE_LightProbesInfo *pinfo = sldata->probes;
1115  LightCache *light_cache = vedata->stl->g_data->light_cache;
1116 
1117  pinfo->samples_len = 512.0f; /* TODO: refine. */
1118  pinfo->shres = vis_size;
1119  pinfo->visibility_range = vis_range;
1120  pinfo->visibility_blur = vis_blur;
1121  pinfo->near_clip = -clipsta;
1122  pinfo->far_clip = -clipend;
1123  pinfo->texel_size = 1.0f / (float)vis_size;
1124 
1125  int cell_per_col = GPU_texture_height(light_cache->grid_tx.tex) / vis_size;
1126  int cell_per_row = GPU_texture_width(light_cache->grid_tx.tex) / vis_size;
1127  int x = vis_size * (grid_offset % cell_per_row);
1128  int y = vis_size * ((grid_offset / cell_per_row) % cell_per_col);
1129  int layer = 1 + ((grid_offset / cell_per_row) / cell_per_col);
1130 
1131  GPU_framebuffer_ensure_config(
1132  &fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE_LAYER(light_cache->grid_tx.tex, layer)});
1134  GPU_framebuffer_viewport_set(fb, x, y, vis_size, vis_size);
1137 }
1138 
1139 /* Actually a simple down-sampling. */
1140 static void downsample_planar(void *vedata, int level)
1141 {
1142  EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
1143  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
1144 
1145  const float *size = DRW_viewport_size_get();
1147  for (int i = 0; i < level - 1; i++) {
1148  stl->g_data->planar_texel_size[0] /= 2.0f;
1149  stl->g_data->planar_texel_size[1] /= 2.0f;
1150  min_ff(floorf(stl->g_data->planar_texel_size[0]), 1.0f);
1151  min_ff(floorf(stl->g_data->planar_texel_size[1]), 1.0f);
1152  }
1154 
1156 }
1157 
1159 {
1160  EEVEE_TextureList *txl = vedata->txl;
1161  EEVEE_FramebufferList *fbl = vedata->fbl;
1162 
1163  DRW_stats_group_start("Planar Probe Downsample");
1164 
1165  GPU_framebuffer_ensure_config(&fbl->planar_downsample_fb,
1166  {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->planar_pool)});
1167 
1171 }
1172 
1176 {
1177  EEVEE_CommonUniformBuffer *common_data = &sldata->common_data;
1178  EEVEE_LightProbesInfo *pinfo = sldata->probes;
1179 
1180  if (pinfo->num_planar == 0) {
1181  /* Disable SSR if we cannot read previous frame */
1182  common_data->ssr_toggle = vedata->stl->g_data->valid_double_buffer;
1183  common_data->prb_num_planar = 0;
1184  return;
1185  }
1186 
1187  float hiz_uv_scale_prev[2] = {UNPACK2(common_data->hiz_uv_scale)};
1188 
1189  /* Temporary Remove all planar reflections (avoid lag effect). */
1190  common_data->prb_num_planar = 0;
1191  /* Turn off ssr to avoid black specular */
1192  common_data->ssr_toggle = false;
1193  common_data->ssrefract_toggle = false;
1194  common_data->sss_toggle = false;
1195 
1196  if (vedata->stl->g_data->disable_ligthprobes) {
1197  sldata->common_data.prb_num_render_cube = 1;
1198  sldata->common_data.prb_num_render_grid = 1;
1199  }
1200 
1201  common_data->ray_type = EEVEE_RAY_GLOSSY;
1202  common_data->ray_depth = 1.0f;
1203  /* Planar reflections are rendered at the `hiz` resolution, so no need to scaling. */
1204  copy_v2_fl(common_data->hiz_uv_scale, 1.0f);
1205 
1206  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
1207 
1208  /* Rendering happens here! */
1210 
1211  /* Make sure no additional visibility check runs after this. */
1212  pinfo->vis_data.collection = NULL;
1213 
1214  GPU_uniformbuf_update(sldata->planar_ubo, &sldata->probes->planar_data);
1215 
1216  /* Restore */
1217  common_data->prb_num_planar = pinfo->num_planar;
1218  common_data->ssr_toggle = true;
1219  common_data->ssrefract_toggle = true;
1220  common_data->sss_toggle = true;
1221  copy_v2_v2(common_data->hiz_uv_scale, hiz_uv_scale_prev);
1222 
1223  /* Prefilter for SSR */
1224  if ((vedata->stl->effects->enabled_effects & EFFECT_SSR) != 0) {
1226  }
1227 
1228  if (DRW_state_is_image_render()) {
1229  /* Sort the transparent passes because planar reflections could have re-sorted them. */
1231  }
1232 
1233  /* Disable SSR if we cannot read previous frame */
1234  common_data->ssr_toggle = vedata->stl->g_data->valid_double_buffer;
1235 }
1236 
1238 {
1239  const DRWContextState *draw_ctx = DRW_context_state_get();
1240  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
1241  LightCache *light_cache = vedata->stl->g_data->light_cache;
1242 
1243  if ((light_cache->flag & LIGHTCACHE_UPDATE_WORLD) &&
1244  (light_cache->flag & LIGHTCACHE_BAKED) == 0) {
1245  EEVEE_lightbake_update_world_quick(sldata, vedata, scene_eval);
1246  }
1247 }
1248 
1250 {
1251  MEM_SAFE_FREE(e_data.format_probe_display_planar);
1252  DRW_TEXTURE_FREE_SAFE(e_data.planar_pool_placeholder);
1253  DRW_TEXTURE_FREE_SAFE(e_data.depth_placeholder);
1254  DRW_TEXTURE_FREE_SAFE(e_data.depth_array_placeholder);
1255 }
typedef float(TangentPoint)[2]
bool BKE_collection_has_object_recursive(struct Collection *collection, struct Object *ob)
Definition: collection.c:921
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.cc:3645
#define BLI_assert(a)
Definition: BLI_assert.h:46
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)
#define M_PI_2
Definition: BLI_math_base.h:23
MINLINE float square_f(float a)
MINLINE unsigned int log2_floor_u(unsigned int x)
void perspective_m4(float mat[4][4], float left, float right, float bottom, float top, float nearClip, float farClip)
Definition: math_geom.c:4542
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1206
void unit_m4(float m[4][4])
Definition: rct.c:1090
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
void scale_m4_fl(float R[4][4], float scale)
Definition: math_matrix.c:2297
void normalize_m4_m4(float R[4][4], const float M[4][4]) ATTR_NONNULL()
Definition: math_matrix.c:1965
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:77
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_TYPE_CUBE
@ LIGHTPROBE_TYPE_PLANAR
@ LIGHTPROBE_TYPE_GRID
@ LIGHTPROBE_FLAG_INVERT_GROUP
@ LIGHTPROBE_FLAG_SHOW_DATA
@ LIGHTPROBE_FLAG_CUSTOM_PARALLAX
@ SCE_EEVEE_SHOW_IRRADIANCE
@ SCE_EEVEE_SHOW_CUBEMAPS
@ SCE_EEVEE_GI_AUTOBAKE
#define DRW_shgroup_instance_format(format,...)
Definition: DRW_render.h:381
@ DRW_TEX_MIPMAP
Definition: DRW_render.h:143
@ DRW_TEX_FILTER
Definition: DRW_render.h:140
#define DRW_buffer_add_entry(buffer,...)
Definition: DRW_render.h:486
DRWState
Definition: DRW_render.h:298
@ DRW_STATE_DEPTH_EQUAL
Definition: DRW_render.h:312
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:302
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:311
@ DRW_STATE_CULL_BACK
Definition: DRW_render.h:316
#define DRW_shgroup_uniform_block_ref(shgroup, name, ubo)
Definition: DRW_render.h:653
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:690
#define DRW_shgroup_uniform_block(shgroup, name, ubo)
Definition: DRW_render.h:651
#define DRW_shgroup_call(shgroup, geom, ob)
Definition: DRW_render.h:414
#define DRW_TEXTURE_FREE_SAFE(tex)
Definition: DRW_render.h:183
GPUBatch
Definition: GPU_batch.h:78
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 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
_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
int GPU_texture_height(const GPUTexture *tex)
Definition: gpu_texture.cc:607
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
int GPU_texture_width(const GPUTexture *tex)
Definition: gpu_texture.cc:602
@ GPU_DEPTH_COMPONENT24
Definition: GPU_texture.h:166
@ GPU_R11F_G11F_B10F
Definition: GPU_texture.h:118
@ GPU_RGBA8
Definition: GPU_texture.h:87
#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 Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
#define NC_LIGHTPROBE
Definition: WM_types.h:352
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
#define cosf(x)
Definition: cuda/compat.h:101
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:389
GPUBatch * DRW_cache_fullscreen_quad_get(void)
Definition: draw_cache.c:356
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:288
const float * DRW_viewport_screenvecs_get(void)
Definition: draw_manager.c:298
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_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_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_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
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)
static struct @318 g_data
EEVEE_LightProbeEngineData * EEVEE_lightprobe_data_ensure(Object *ob)
Definition: eevee_data.c:316
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 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 struct @201 e_data
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:73
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:34
#define MAX_PROBE
Definition: eevee_private.h:32
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:33
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)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
const int state
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
ccl_device_inline float3 log(float3 v)
Definition: math_float3.h:397
#define floorf(x)
Definition: metal/compat.h:224
#define sqrtf(x)
Definition: metal/compat.h:243
#define min(a, b)
Definition: sort.c:35
float vec[8][3]
struct Scene * scene
Definition: DRW_render.h:979
const struct bContext * evil_C
Definition: DRW_render.h:997
struct Depsgraph * depsgraph
Definition: DRW_render.h:987
struct View3D * v3d
Definition: DRW_render.h:976
EEVEE_ViewLayerData * sldata
struct GPUFrameBuffer ** face_fb
EEVEE_TextureList * txl
EEVEE_StorageList * stl
EEVEE_PassList * psl
EEVEE_FramebufferList * fbl
char info[GPU_INFO_SIZE]
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::@210 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)