Blender  V3.3
eevee_shadows.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2019 Blender Foundation. */
3 
8 #include "BLI_string_utils.h"
9 #include "BLI_sys_types.h" /* bool */
10 
11 #include "BKE_object.h"
12 
13 #include "DEG_depsgraph_query.h"
14 
15 #include "eevee_private.h"
16 
17 #define SH_CASTER_ALLOC_CHUNK 32
18 
20 {
21  evsh->contact_dist = (la->mode & LA_SHAD_CONTACT) ? la->contact_dist : 0.0f;
22  evsh->contact_bias = 0.05f * la->contact_bias;
24 }
25 
27 {
28  const uint shadow_ubo_size = sizeof(EEVEE_Shadow) * MAX_SHADOW +
31 
32  const DRWContextState *draw_ctx = DRW_context_state_get();
33  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
34 
35  if (!sldata->lights) {
36  sldata->lights = MEM_callocN(sizeof(EEVEE_LightsInfo), "EEVEE_LightsInfo");
37  sldata->light_ubo = GPU_uniformbuf_create_ex(sizeof(EEVEE_Light) * MAX_LIGHT, NULL, "evLight");
38  sldata->shadow_ubo = GPU_uniformbuf_create_ex(shadow_ubo_size, NULL, "evShadow");
39 
40  for (int i = 0; i < 2; i++) {
41  sldata->shcasters_buffers[i].bbox = MEM_mallocN(
42  sizeof(EEVEE_BoundBox) * SH_CASTER_ALLOC_CHUNK, __func__);
43  sldata->shcasters_buffers[i].update = BLI_BITMAP_NEW(SH_CASTER_ALLOC_CHUNK, __func__);
44  sldata->shcasters_buffers[i].alloc_count = SH_CASTER_ALLOC_CHUNK;
45  sldata->shcasters_buffers[i].count = 0;
46  }
47  sldata->lights->shcaster_frontbuffer = &sldata->shcasters_buffers[0];
48  sldata->lights->shcaster_backbuffer = &sldata->shcasters_buffers[1];
49  }
50 
51  /* Flip buffers */
54  sldata->lights->shcaster_backbuffer);
55 
56  int sh_cube_size = scene_eval->eevee.shadow_cube_size;
57  int sh_cascade_size = scene_eval->eevee.shadow_cascade_size;
58  const bool sh_high_bitdepth = (scene_eval->eevee.flag & SCE_EEVEE_SHADOW_HIGH_BITDEPTH) != 0;
59  sldata->lights->soft_shadows = (scene_eval->eevee.flag & SCE_EEVEE_SHADOW_SOFT) != 0;
60 
61  EEVEE_LightsInfo *linfo = sldata->lights;
62  if ((linfo->shadow_cube_size != sh_cube_size) ||
63  (linfo->shadow_high_bitdepth != sh_high_bitdepth)) {
64  BLI_assert((sh_cube_size > 0) && (sh_cube_size <= 4096));
66  CLAMP(sh_cube_size, 1, 4096);
67  }
68 
69  if ((linfo->shadow_cascade_size != sh_cascade_size) ||
70  (linfo->shadow_high_bitdepth != sh_high_bitdepth)) {
71  BLI_assert((sh_cascade_size > 0) && (sh_cascade_size <= 4096));
73  CLAMP(sh_cascade_size, 1, 4096);
74  }
75 
76  linfo->shadow_high_bitdepth = sh_high_bitdepth;
77  linfo->shadow_cube_size = sh_cube_size;
78  linfo->shadow_cascade_size = sh_cascade_size;
79 }
80 
82 {
83  EEVEE_LightsInfo *linfo = sldata->lights;
84  EEVEE_StorageList *stl = vedata->stl;
85  EEVEE_PassList *psl = vedata->psl;
86 
87  EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
88  EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
89 
90  frontbuffer->count = 0;
91  linfo->num_cube_layer = 0;
92  linfo->num_cascade_layer = 0;
93  linfo->cube_len = linfo->cascade_len = linfo->shadow_len = 0;
94 
95  /* Shadow Casters: Reset flags. */
96  BLI_bitmap_set_all(backbuffer->update, true, backbuffer->alloc_count);
97  /* Is this one needed? */
98  BLI_bitmap_set_all(frontbuffer->update, false, frontbuffer->alloc_count);
99 
101 
102  {
105 
107  psl->shadow_pass);
108  }
109 }
110 
112 {
113  EEVEE_LightsInfo *linfo = sldata->lights;
114  EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
115  EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
116  bool update = true;
117  int id = frontbuffer->count;
118 
119  /* Make sure shadow_casters is big enough. */
120  if (id >= frontbuffer->alloc_count) {
121  /* Double capacity to prevent exponential slowdown. */
122  frontbuffer->alloc_count *= 2;
123  frontbuffer->bbox = MEM_reallocN(frontbuffer->bbox,
124  sizeof(EEVEE_BoundBox) * frontbuffer->alloc_count);
125  BLI_BITMAP_RESIZE(frontbuffer->update, frontbuffer->alloc_count);
126  }
127 
128  if (ob->base_flag & BASE_FROM_DUPLI) {
129  /* Duplis will always refresh the shadow-maps as if they were deleted each frame. */
130  /* TODO(fclem): fix this. */
131  update = true;
132  }
133  else {
135  int past_id = oedata->shadow_caster_id;
136  oedata->shadow_caster_id = id;
137  /* Update flags in backbuffer. */
138  if (past_id > -1 && past_id < backbuffer->count) {
139  BLI_BITMAP_SET(backbuffer->update, past_id, oedata->need_update);
140  }
141  update = oedata->need_update;
142  oedata->need_update = false;
143  }
144 
145  if (update) {
146  BLI_BITMAP_ENABLE(frontbuffer->update, id);
147  }
148 
149  /* Update World AABB in frontbuffer. */
150  const BoundBox *bb = BKE_object_boundbox_get(ob);
151  float min[3], max[3];
152  INIT_MINMAX(min, max);
153  for (int i = 0; i < 8; i++) {
154  float vec[3];
155  copy_v3_v3(vec, bb->vec[i]);
156  mul_m4_v3(ob->obmat, vec);
157  minmax_v3v3_v3(min, max, vec);
158  }
159 
160  EEVEE_BoundBox *aabb = &frontbuffer->bbox[id];
161  /* Note that `*aabb` has not been initialized yet. */
162  add_v3_v3v3(aabb->center, min, max);
163  mul_v3_fl(aabb->center, 0.5f);
164  sub_v3_v3v3(aabb->halfdim, aabb->center, max);
165 
166  aabb->halfdim[0] = fabsf(aabb->halfdim[0]);
167  aabb->halfdim[1] = fabsf(aabb->halfdim[1]);
168  aabb->halfdim[2] = fabsf(aabb->halfdim[2]);
169 
172 
173  frontbuffer->count++;
174 }
175 
176 /* Used for checking if object is inside the shadow volume. */
177 static bool sphere_bbox_intersect(const BoundSphere *bs, const EEVEE_BoundBox *bb)
178 {
179  /* We are testing using a rougher AABB vs AABB test instead of full AABB vs Sphere. */
180  /* TODO: test speed with AABB vs Sphere. */
181  bool x = fabsf(bb->center[0] - bs->center[0]) <= (bb->halfdim[0] + bs->radius);
182  bool y = fabsf(bb->center[1] - bs->center[1]) <= (bb->halfdim[1] + bs->radius);
183  bool z = fabsf(bb->center[2] - bs->center[2]) <= (bb->halfdim[2] + bs->radius);
184 
185  return x && y && z;
186 }
187 
189 {
190  EEVEE_StorageList *stl = vedata->stl;
191  EEVEE_EffectsInfo *effects = stl->effects;
192  EEVEE_LightsInfo *linfo = sldata->lights;
193  EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
194  EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
195 
196  eGPUTextureFormat shadow_pool_format = (linfo->shadow_high_bitdepth) ? GPU_DEPTH_COMPONENT24 :
198  /* Setup enough layers. */
199  /* Free textures if number mismatch. */
200  if (linfo->num_cube_layer != linfo->cache_num_cube_layer) {
202  linfo->cache_num_cube_layer = linfo->num_cube_layer;
203  /* Update all lights. */
204  BLI_bitmap_set_all(&linfo->sh_cube_update[0], true, MAX_LIGHT);
205  }
206 
207  if (linfo->num_cascade_layer != linfo->cache_num_cascade_layer) {
210  }
211 
212  if (!sldata->shadow_cube_pool) {
214  linfo->shadow_cube_size,
215  max_ii(1, linfo->num_cube_layer * 6),
216  shadow_pool_format,
218  NULL);
219  }
220 
221  if (!sldata->shadow_cascade_pool) {
223  linfo->shadow_cascade_size,
224  max_ii(1, linfo->num_cascade_layer),
225  shadow_pool_format,
227  NULL);
228  }
229 
230  if (sldata->shadow_fb == NULL) {
231  sldata->shadow_fb = GPU_framebuffer_create("shadow_fb");
232  }
233 
234  /* Gather all light own update bits. to avoid costly intersection check. */
235  for (int j = 0; j < linfo->cube_len; j++) {
236  const EEVEE_Light *evli = linfo->light_data + linfo->shadow_cube_light_indices[j];
237  /* Setup shadow cube in UBO and tag for update if necessary. */
238  if (EEVEE_shadows_cube_setup(linfo, evli, effects->taa_current_sample - 1)) {
239  BLI_BITMAP_ENABLE(&linfo->sh_cube_update[0], j);
240  }
241  }
242 
243  /* TODO(fclem): This part can be slow, optimize it. */
244  EEVEE_BoundBox *bbox = backbuffer->bbox;
245  BoundSphere *bsphere = linfo->shadow_bounds;
246  /* Search for deleted shadow casters or if shcaster WAS in shadow radius. */
247  for (int i = 0; i < backbuffer->count; i++) {
248  /* If the shadow-caster has been deleted or updated. */
249  if (BLI_BITMAP_TEST(backbuffer->update, i)) {
250  for (int j = 0; j < linfo->cube_len; j++) {
251  if (!BLI_BITMAP_TEST(&linfo->sh_cube_update[0], j)) {
252  if (sphere_bbox_intersect(&bsphere[j], &bbox[i])) {
253  BLI_BITMAP_ENABLE(&linfo->sh_cube_update[0], j);
254  }
255  }
256  }
257  }
258  }
259  /* Search for updates in current shadow casters. */
260  bbox = frontbuffer->bbox;
261  for (int i = 0; i < frontbuffer->count; i++) {
262  /* If the shadow-caster has been updated. */
263  if (BLI_BITMAP_TEST(frontbuffer->update, i)) {
264  for (int j = 0; j < linfo->cube_len; j++) {
265  if (!BLI_BITMAP_TEST(&linfo->sh_cube_update[0], j)) {
266  if (sphere_bbox_intersect(&bsphere[j], &bbox[i])) {
267  BLI_BITMAP_ENABLE(&linfo->sh_cube_update[0], j);
268  }
269  }
270  }
271  }
272  }
273 
274  /* Resize shcasters buffers if too big. */
275  if (frontbuffer->alloc_count - frontbuffer->count > SH_CASTER_ALLOC_CHUNK) {
276  frontbuffer->alloc_count = divide_ceil_u(max_ii(1, frontbuffer->count),
279  frontbuffer->bbox = MEM_reallocN(frontbuffer->bbox,
280  sizeof(EEVEE_BoundBox) * frontbuffer->alloc_count);
281  BLI_BITMAP_RESIZE(frontbuffer->update, frontbuffer->alloc_count);
282  }
283 }
284 
286 {
287  EEVEE_LightsInfo *linfo = sldata->lights;
288 
289  int saved_ray_type = sldata->common_data.ray_type;
290 
291  /* Precompute all shadow/view test before rendering and trashing the culling cache. */
293  bool any_visible = linfo->cascade_len > 0;
294  for (int cube = 0; cube < linfo->cube_len; cube++) {
296  BLI_BITMAP_ENABLE(cube_visible, cube);
297  any_visible = true;
298  }
299  }
300 
301  if (any_visible) {
303  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
304  }
305 
306  DRW_stats_group_start("Cube Shadow Maps");
307  {
308  for (int cube = 0; cube < linfo->cube_len; cube++) {
309  if (BLI_BITMAP_TEST(cube_visible, cube) && BLI_BITMAP_TEST(linfo->sh_cube_update, cube)) {
310  EEVEE_shadows_draw_cubemap(sldata, vedata, cube);
311  }
312  }
313  }
315 
316  DRW_stats_group_start("Cascaded Shadow Maps");
317  {
318  for (int cascade = 0; cascade < linfo->cascade_len; cascade++) {
319  EEVEE_shadows_draw_cascades(sldata, vedata, view, cascade);
320  }
321  }
323 
325 
326  GPU_uniformbuf_update(sldata->shadow_ubo, &linfo->shadow_data); /* Update all data at once */
327 
328  if (any_visible) {
329  sldata->common_data.ray_type = saved_ray_type;
330  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
331  }
332 }
333 
334 /* -------------------------------------------------------------------- */
339  EEVEE_Data *vedata,
340  uint UNUSED(tot_samples))
341 {
342  EEVEE_FramebufferList *fbl = vedata->fbl;
343  EEVEE_TextureList *txl = vedata->txl;
344  EEVEE_PassList *psl = vedata->psl;
346 
347  /* Create FrameBuffer. */
348  const eGPUTextureFormat texture_format = GPU_R32F;
349  DRW_texture_ensure_fullscreen_2d(&txl->shadow_accum, texture_format, 0);
350 
351  GPU_framebuffer_ensure_config(&fbl->shadow_accum_fb,
352  {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->shadow_accum)});
353 
354  /* Create Pass and shgroup. */
358  psl->shadow_accum_pass);
359  DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
361  DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo);
362  DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo);
363  DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo);
364  DRW_shgroup_uniform_block(grp, "light_block", sldata->light_ubo);
365  DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo);
366  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
367  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
368  DRW_shgroup_uniform_texture_ref(grp, "shadowCubeTexture", &sldata->shadow_cube_pool);
369  DRW_shgroup_uniform_texture_ref(grp, "shadowCascadeTexture", &sldata->shadow_cascade_pool);
370 
372 }
373 
375 {
376  EEVEE_FramebufferList *fbl = vedata->fbl;
377  EEVEE_PassList *psl = vedata->psl;
378  EEVEE_EffectsInfo *effects = vedata->stl->effects;
379 
380  if (fbl->shadow_accum_fb != NULL) {
382 
383  /* Clear texture. */
384  if (effects->taa_current_sample == 1) {
385  const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f};
386  GPU_framebuffer_clear_color(fbl->shadow_accum_fb, clear);
387  }
388 
390 
391  /* Restore */
393  }
394 }
395 
General operations, lookup, etc. for blender objects.
const struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.cc:3684
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define BLI_BITMAP_NEW_ALLOCA(_num)
Definition: BLI_bitmap.h:46
#define BLI_BITMAP_NEW(_num, _alloc_string)
Definition: BLI_bitmap.h:40
#define BLI_BITMAP_TEST(_bitmap, _index)
Definition: BLI_bitmap.h:64
#define BLI_BITMAP_ENABLE(_bitmap, _index)
Definition: BLI_bitmap.h:81
#define BLI_BITMAP_RESIZE(_bitmap, _num)
Definition: BLI_bitmap.h:117
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits)
Definition: bitmap.c:17
#define BLI_BITMAP_SET(_bitmap, _index, _set)
Definition: BLI_bitmap.h:102
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:16
MINLINE uint divide_ceil_u(uint a, uint b)
MINLINE int max_ii(int a, int b)
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
Definition: math_vector.c:867
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
unsigned int uint
Definition: BLI_sys_types.h:67
#define INIT_MINMAX(min, max)
#define SWAP(type, a, b)
#define UNUSED(x)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ BASE_FROM_DUPLI
#define LA_SHAD_CONTACT
@ SCE_EEVEE_SHADOW_HIGH_BITDEPTH
@ SCE_EEVEE_SHADOW_SOFT
@ DRW_TEX_FILTER
Definition: DRW_render.h:140
@ DRW_TEX_COMPARE
Definition: DRW_render.h:142
DRWState
Definition: DRW_render.h:298
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:302
@ DRW_STATE_SHADOW_OFFSET
Definition: DRW_render.h:341
@ DRW_STATE_BLEND_ADD_FULL
Definition: DRW_render.h:326
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:311
@ DRW_STATE_DEPTH_ALWAYS
Definition: DRW_render.h:309
#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
static AppView * view
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
GPUFrameBuffer * GPU_framebuffer_create(const char *name)
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_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
eGPUTextureFormat
Definition: GPU_texture.h:83
@ GPU_DEPTH_COMPONENT24
Definition: GPU_texture.h:166
@ GPU_DEPTH_COMPONENT16
Definition: GPU_texture.h:167
GPUUniformBuf * GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name)
void GPU_uniformbuf_update(GPUUniformBuf *ubo, const void *data)
#define MEM_reallocN(vmemh, len)
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
GPUBatch * DRW_cache_fullscreen_quad_get(void)
Definition: draw_cache.c:356
const DRWContextState * DRW_context_state_get(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition: draw_manager.c:638
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
bool DRW_culling_sphere_test(const DRWView *view, const BoundSphere *bsphere)
void DRW_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
void DRW_stats_group_start(const char *name)
void DRW_stats_group_end(void)
void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
GPUTexture * DRW_texture_create_2d_array(int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
EEVEE_ObjectEngineData * EEVEE_object_data_ensure(Object *ob)
Definition: eevee_data.c:290
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx GPU_R32F
struct GPUTexture * EEVEE_materials_get_util_tex(void)
struct EEVEE_Shadow EEVEE_Shadow
#define MAX_SHADOW_CASCADE
Definition: eevee_private.h:38
struct GPUShader * EEVEE_shaders_shadow_accum_sh_get(void)
struct EEVEE_ShadowCascade EEVEE_ShadowCascade
bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli, int sample_ofs)
void EEVEE_shadows_draw_cascades(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView *view, int cascade_index)
#define EEVEE_RAY_SHADOW
EEVEE_ShadowCasterBuffer
#define MAX_SHADOW_CUBE
Definition: eevee_private.h:39
#define MAX_LIGHT
Definition: eevee_private.h:35
struct GPUShader * EEVEE_shaders_shadow_sh_get(void)
void EEVEE_shadows_draw_cubemap(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, int cube_index)
#define MAX_SHADOW
Definition: eevee_private.h:37
void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_shadows_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
Definition: eevee_shadows.c:81
void EEVEE_shadow_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, uint UNUSED(tot_samples))
#define SH_CASTER_ALLOC_CHUNK
Definition: eevee_shadows.c:17
void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob)
void EEVEE_shadow_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
void EEVEE_shadows_init(EEVEE_ViewLayerData *sldata)
Definition: eevee_shadows.c:26
void EEVEE_shadows_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView *view)
static bool sphere_bbox_intersect(const BoundSphere *bs, const EEVEE_BoundBox *bb)
void eevee_contact_shadow_setup(const Light *la, EEVEE_Shadow *evsh)
Definition: eevee_shadows.c:19
int count
const int state
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
#define fabsf(x)
Definition: metal/compat.h:219
static void clear(Message *msg)
Definition: msgfmt.c:278
static void update(bNodeTree *ntree)
#define min(a, b)
Definition: sort.c:35
float vec[8][3]
float center[3]
Definition: DRW_render.h:86
float radius
Definition: DRW_render.h:86
struct GPUTexture * depth
float halfdim[3]
EEVEE_TextureList * txl
EEVEE_StorageList * stl
EEVEE_PassList * psl
EEVEE_FramebufferList * fbl
struct GPUFrameBuffer * main_fb
struct GPUFrameBuffer * shadow_accum_fb
struct EEVEE_Light light_data[MAX_LIGHT]
struct EEVEE_LightsInfo::@207 shcaster_aabb
struct EEVEE_ShadowCasterBuffer * shcaster_frontbuffer
struct EEVEE_Shadow shadow_data[MAX_SHADOW]
struct BoundSphere shadow_bounds[MAX_LIGHT]
BLI_bitmap sh_cube_update[BLI_BITMAP_SIZE(MAX_SHADOW_CUBE)]
uchar shadow_cube_light_indices[MAX_SHADOW_CUBE]
struct EEVEE_ShadowCasterBuffer * shcaster_backbuffer
struct DRWPass * shadow_accum_pass
struct DRWPass * shadow_pass
struct DRWShadingGroup * shadow_shgrp
float contact_bias
float contact_thickness
float contact_dist
struct EEVEE_PrivateData * g_data
struct EEVEE_EffectsInfo * effects
struct GPUTexture * shadow_accum
struct EEVEE_CommonUniformBuffer common_data
struct GPUTexture * shadow_cube_pool
struct GPUUniformBuf * combined
struct GPUUniformBuf * shadow_ubo
struct GPUUniformBuf * probe_ubo
struct GPUUniformBuf * grid_ubo
struct GPUFrameBuffer * shadow_fb
struct GPUUniformBuf * planar_ubo
struct EEVEE_ViewLayerData::@210 renderpass_ubo
struct GPUUniformBuf * common_ubo
struct GPUUniformBuf * light_ubo
struct GPUTexture * shadow_cascade_pool
struct EEVEE_ShadowCasterBuffer shcasters_buffers[2]
struct EEVEE_LightsInfo * lights
float contact_thickness
float contact_dist
float contact_bias
short base_flag
float obmat[4][4]
struct SceneEEVEE eevee
float max