diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-05-04 15:39:05 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-05-04 17:22:23 +0300 |
commit | f48e53f5625b5c4091cddee09154b43ee98ecfdb (patch) | |
tree | 6c9361360d1bc5631795c97650523f675758d325 /source/blender/draw/engines | |
parent | d4dd872d56b34f9ce0b03d570cddff52460b5b0f (diff) |
Eevee: Shadows: Separate Cube and Cascade shadow maps into 2 texture array.
This mean we can now have different shadow resolutions for both.
However each shadow type keep the same size accross all lamps because of
future "real" Cube Shadowmaps limitation and to save texture sampler slots.
That said the cascade shadow resolution could (in the future) still be
changed to be adjustable per sun lamp.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_data.c | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_engine.c | 3 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lights.c | 117 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_materials.c | 3 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_private.h | 11 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_volumes.c | 3 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lamps_lib.glsl | 15 |
7 files changed, 97 insertions, 61 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c index 5adcf9e9ffb..e9883cc3054 100644 --- a/source/blender/draw/engines/eevee/eevee_data.c +++ b/source/blender/draw/engines/eevee/eevee_data.c @@ -39,13 +39,15 @@ static void eevee_view_layer_data_free(void *storage) DRW_UBO_FREE_SAFE(sldata->shadow_ubo); DRW_UBO_FREE_SAFE(sldata->shadow_render_ubo); GPU_FRAMEBUFFER_FREE_SAFE(sldata->shadow_cube_target_fb); + GPU_FRAMEBUFFER_FREE_SAFE(sldata->shadow_cube_store_fb); GPU_FRAMEBUFFER_FREE_SAFE(sldata->shadow_cascade_target_fb); - GPU_FRAMEBUFFER_FREE_SAFE(sldata->shadow_store_fb); + GPU_FRAMEBUFFER_FREE_SAFE(sldata->shadow_cascade_store_fb); DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_target); DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_blur); + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_pool); DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_target); DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_blur); - DRW_TEXTURE_FREE_SAFE(sldata->shadow_pool); + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_pool); MEM_SAFE_FREE(sldata->shcasters_buffers[0].shadow_casters); MEM_SAFE_FREE(sldata->shcasters_buffers[0].flags); MEM_SAFE_FREE(sldata->shcasters_buffers[1].shadow_casters); diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index afea335d733..1c0247068cc 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -497,7 +497,8 @@ static void eevee_view_layer_settings_create(RenderEngine *UNUSED(engine), IDPro BKE_collection_engine_property_add_float(props, "motion_blur_shutter", 1.0f); BKE_collection_engine_property_add_int(props, "shadow_method", SHADOW_ESM); - BKE_collection_engine_property_add_int(props, "shadow_size", 512); + BKE_collection_engine_property_add_int(props, "shadow_cube_size", 512); + BKE_collection_engine_property_add_int(props, "shadow_cascade_size", 1024); BKE_collection_engine_property_add_bool(props, "shadow_high_bitdepth", false); } diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index b7adcbf0835..b7790d7dd0f 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -129,30 +129,24 @@ void EEVEE_lights_init(EEVEE_ViewLayerData *sldata) SWAP(EEVEE_ShadowCasterBuffer *, sldata->lamps->shcaster_frontbuffer, sldata->lamps->shcaster_backbuffer); int sh_method = BKE_collection_engine_property_value_get_int(props, "shadow_method"); - int sh_size = BKE_collection_engine_property_value_get_int(props, "shadow_size"); + int sh_cube_size = BKE_collection_engine_property_value_get_int(props, "shadow_cube_size"); + int sh_cascade_size = BKE_collection_engine_property_value_get_int(props, "shadow_cascade_size"); int sh_high_bitdepth = BKE_collection_engine_property_value_get_int(props, "shadow_high_bitdepth"); EEVEE_LampsInfo *linfo = sldata->lamps; - if ((linfo->shadow_size != sh_size) || + if ((linfo->shadow_cube_size != sh_cube_size) || (linfo->shadow_method != sh_method) || (linfo->shadow_high_bitdepth != sh_high_bitdepth)) { - BLI_assert((sh_size > 0) && (sh_size <= 8192)); - DRW_TEXTURE_FREE_SAFE(sldata->shadow_pool); + BLI_assert((sh_cube_size > 0) && (sh_cube_size <= 8192)); + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_pool); DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_target); - DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_target); DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_blur); - DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_blur); - - linfo->shadow_high_bitdepth = sh_high_bitdepth; - linfo->shadow_method = sh_method; - linfo->shadow_size = sh_size; - linfo->shadow_render_data.stored_texel_size = 1.0 / (float)linfo->shadow_size; /* Compute adequate size for the cubemap render target. * The 3.0f factor is here to make sure there is no under sampling between * the octahedron mapping and the cubemap. */ - int new_cube_target_size = (int)ceil(sqrt((float)(sh_size * sh_size) / 6.0f) * 3.0f); + int new_cube_target_size = (int)ceil(sqrt((float)(sh_cube_size * sh_cube_size) / 6.0f) * 3.0f); CLAMP(new_cube_target_size, 1, 4096); @@ -160,6 +154,21 @@ void EEVEE_lights_init(EEVEE_ViewLayerData *sldata) linfo->shadow_render_data.cube_texel_size = 1.0 / (float)linfo->shadow_cube_target_size; } + if ((linfo->shadow_cascade_size != sh_cascade_size) || + (linfo->shadow_method != sh_method) || + (linfo->shadow_high_bitdepth != sh_high_bitdepth)) + { + BLI_assert((sh_cascade_size > 0) && (sh_cascade_size <= 8192)); + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_pool); + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_target); + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cascade_blur); + } + + linfo->shadow_high_bitdepth = sh_high_bitdepth; + linfo->shadow_method = sh_method; + linfo->shadow_cube_size = sh_cube_size; + linfo->shadow_cascade_size = sh_cascade_size; + /* only compile the ones needed. reduce startup time. */ if ((sh_method == SHADOW_ESM) && !e_data.shadow_store_cube_sh[SHADOW_ESM]) { DynStr *ds_frag = BLI_dynstr_new(); @@ -223,7 +232,8 @@ void EEVEE_lights_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) linfo->shcaster_frontbuffer->count = 0; linfo->num_light = 0; - linfo->num_layer = 0; + linfo->num_cube_layer = 0; + linfo->num_cascade_layer = 0; linfo->gpu_cube_ct = linfo->gpu_cascade_ct = linfo->gpu_shadow_ct = 0; linfo->cpu_cube_ct = linfo->cpu_cascade_ct = 0; memset(linfo->light_ref, 0, sizeof(linfo->light_ref)); @@ -331,12 +341,12 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob) EEVEE_ShadowCascadeData *data = &led->data.scad; data->shadow_id = linfo->gpu_shadow_ct; data->cascade_id = linfo->gpu_cascade_ct; - data->layer_id = linfo->num_layer; + data->layer_id = linfo->num_cascade_layer; /* Increment indices. */ linfo->gpu_shadow_ct += 1; linfo->gpu_cascade_ct += sh_nbr; - linfo->num_layer += sh_nbr * cascade_nbr; + linfo->num_cascade_layer += sh_nbr * cascade_nbr; linfo->cpu_cascade_ct += 1; } @@ -365,12 +375,12 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob) /* Store indices. */ data->shadow_id = linfo->gpu_shadow_ct; data->cube_id = linfo->gpu_cube_ct; - data->layer_id = linfo->num_layer; + data->layer_id = linfo->num_cube_layer; /* Increment indices. */ linfo->gpu_shadow_ct += 1; linfo->gpu_cube_ct += sh_nbr; - linfo->num_layer += sh_nbr; + linfo->num_cube_layer += sh_nbr; linfo->cpu_cube_ct += 1; } @@ -478,9 +488,15 @@ void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata) /* Setup enough layers. */ /* Free textures if number mismatch. */ - if (linfo->num_layer != linfo->cache_num_layer) { - DRW_TEXTURE_FREE_SAFE(sldata->shadow_pool); - linfo->cache_num_layer = linfo->num_layer; + if (linfo->num_cube_layer != linfo->cache_num_cube_layer) { + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_pool); + linfo->cache_num_cube_layer = linfo->num_cube_layer; + linfo->update_flag |= LIGHT_UPDATE_SHADOW_CUBE; + } + + if (linfo->num_cube_layer != linfo->cache_num_cube_layer) { + DRW_TEXTURE_FREE_SAFE(sldata->shadow_cube_pool); + linfo->cache_num_cube_layer = linfo->num_cube_layer; linfo->update_flag |= LIGHT_UPDATE_SHADOW_CUBE; } @@ -492,27 +508,29 @@ void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata) break; } + /* Cubemaps */ if (!sldata->shadow_cube_target) { - /* TODO render everything on the same 2d render target using clip planes and no Geom Shader. */ - /* Cubemaps */ sldata->shadow_cube_target = DRW_texture_create_cube( linfo->shadow_cube_target_size, GPU_DEPTH_COMPONENT24, 0, NULL); sldata->shadow_cube_blur = DRW_texture_create_cube( linfo->shadow_cube_target_size, shadow_pool_format, DRW_TEX_FILTER, NULL); } + if (!sldata->shadow_cube_pool) { + sldata->shadow_cube_pool = DRW_texture_create_2D_array( + linfo->shadow_cube_size, linfo->shadow_cube_size, max_ff(1, linfo->num_cube_layer), + shadow_pool_format, DRW_TEX_FILTER, NULL); + } + /* CSM */ if (!sldata->shadow_cascade_target) { - /* CSM */ sldata->shadow_cascade_target = DRW_texture_create_2D_array( - linfo->shadow_size, linfo->shadow_size, MAX_CASCADE_NUM, GPU_DEPTH_COMPONENT24, 0, NULL); + linfo->shadow_cascade_size, linfo->shadow_cascade_size, MAX_CASCADE_NUM, GPU_DEPTH_COMPONENT24, 0, NULL); sldata->shadow_cascade_blur = DRW_texture_create_2D_array( - linfo->shadow_size, linfo->shadow_size, MAX_CASCADE_NUM, shadow_pool_format, DRW_TEX_FILTER, NULL); + linfo->shadow_cascade_size, linfo->shadow_cascade_size, MAX_CASCADE_NUM, shadow_pool_format, DRW_TEX_FILTER, NULL); } - - if (!sldata->shadow_pool) { - /* All shadows fit in this array */ - sldata->shadow_pool = DRW_texture_create_2D_array( - linfo->shadow_size, linfo->shadow_size, max_ff(1, linfo->num_layer), + if (!sldata->shadow_cascade_pool) { + sldata->shadow_cascade_pool = DRW_texture_create_2D_array( + linfo->shadow_cascade_size, linfo->shadow_cascade_size, max_ff(1, linfo->num_cascade_layer), shadow_pool_format, DRW_TEX_FILTER, NULL); } @@ -525,9 +543,14 @@ void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata) }); /* Storage FB */ - GPU_framebuffer_ensure_config(&sldata->shadow_store_fb, { + GPU_framebuffer_ensure_config(&sldata->shadow_cube_store_fb, { GPU_ATTACHMENT_NONE, - GPU_ATTACHMENT_TEXTURE(sldata->shadow_pool) + GPU_ATTACHMENT_TEXTURE(sldata->shadow_cube_pool) + }); + + GPU_framebuffer_ensure_config(&sldata->shadow_cascade_store_fb, { + GPU_ATTACHMENT_NONE, + GPU_ATTACHMENT_TEXTURE(sldata->shadow_cascade_pool) }); /* Update Lamps UBOs. */ @@ -860,7 +883,7 @@ static void eevee_shadow_cascade_setup(Object *ob, EEVEE_LampsInfo *linfo, EEVEE /* Snap projection center to nearest texel to cancel shimmering. */ float shadow_origin[2], shadow_texco[2]; /* Light to texture space. */ - mul_v2_v2fl(shadow_origin, center, linfo->shadow_size / (2.0f * sh_data->radius[c])); + mul_v2_v2fl(shadow_origin, center, linfo->shadow_cascade_size / (2.0f * sh_data->radius[c])); /* Find the nearest texel. */ shadow_texco[0] = roundf(shadow_origin[0]); @@ -868,7 +891,7 @@ static void eevee_shadow_cascade_setup(Object *ob, EEVEE_LampsInfo *linfo, EEVEE /* Compute offset. */ sub_v2_v2(shadow_texco, shadow_origin); - mul_v2_fl(shadow_texco, (2.0f * sh_data->radius[c]) / linfo->shadow_size); /* Texture to light space. */ + mul_v2_fl(shadow_texco, (2.0f * sh_data->radius[c]) / linfo->shadow_cascade_size); /* Texture to light space. */ /* Apply offset. */ add_v2_v2(center, shadow_texco); @@ -1045,6 +1068,8 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl) srd->clip_far = la->clipend; copy_v3_v3(srd->position, ob->obmat[3]); + srd->stored_texel_size = 1.0 / (float)linfo->shadow_cube_size; + DRW_uniformbuffer_update(sldata->shadow_render_ubo, srd); /* Render shadow cube */ @@ -1082,9 +1107,9 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl) linfo->current_shadow_face++) { /* Copy using a small 3x3 box filter */ - GPU_framebuffer_texture_cubeface_attach(sldata->shadow_store_fb, sldata->shadow_cube_blur, 0, + GPU_framebuffer_texture_cubeface_attach(sldata->shadow_cube_store_fb, sldata->shadow_cube_blur, 0, linfo->current_shadow_face, 0); - GPU_framebuffer_bind(sldata->shadow_store_fb); + GPU_framebuffer_bind(sldata->shadow_cube_store_fb); DRW_draw_pass(psl->shadow_cube_copy_pass); } @@ -1109,8 +1134,8 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl) srd->shadow_inv_samples_ct = 1.0f / (float)srd->shadow_samples_ct; DRW_uniformbuffer_update(sldata->shadow_render_ubo, srd); - GPU_framebuffer_texture_layer_attach(sldata->shadow_store_fb, sldata->shadow_pool, 0, evscd->layer_id, 0); - GPU_framebuffer_bind(sldata->shadow_store_fb); + GPU_framebuffer_texture_layer_attach(sldata->shadow_cube_store_fb, sldata->shadow_cube_pool, 0, evscd->layer_id, 0); + GPU_framebuffer_bind(sldata->shadow_cube_store_fb); DRW_draw_pass(psl->shadow_cube_store_pass); led->need_update = false; @@ -1142,6 +1167,7 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl) srd->clip_near = la->clipsta; srd->clip_far = la->clipend; + srd->stored_texel_size = 1.0 / (float)linfo->shadow_cascade_size; DRW_uniformbuffer_update(sldata->shadow_render_ubo, &linfo->shadow_render_data); @@ -1174,13 +1200,14 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl) { /* 0.01f factor to convert to percentage */ float filter_texture_size = la->soft * 0.01f / evscd->radius[linfo->current_shadow_cascade]; - float filter_pixel_size = ceil(linfo->shadow_size * filter_texture_size); + float filter_pixel_size = ceil(linfo->shadow_cascade_size * filter_texture_size); /* Copy using a small 3x3 box filter */ - linfo->filter_size = linfo->shadow_render_data.stored_texel_size * ((filter_pixel_size > 1.0f) ? 1.0f : 0.0f); + /* NOTE: We always do it in the case of CSM because of artifacts in the farthest cascade. */ + linfo->filter_size = srd->stored_texel_size; GPU_framebuffer_texture_layer_attach( - sldata->shadow_store_fb, sldata->shadow_cascade_blur, 0, linfo->current_shadow_cascade, 0); - GPU_framebuffer_bind(sldata->shadow_store_fb); + sldata->shadow_cascade_store_fb, sldata->shadow_cascade_blur, 0, linfo->current_shadow_cascade, 0); + GPU_framebuffer_bind(sldata->shadow_cascade_store_fb); DRW_draw_pass(psl->shadow_cascade_copy_pass); /* Push it to shadowmap array and blur more */ @@ -1191,7 +1218,7 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl) const int max_sample = 256; if (filter_pixel_size > 2.0f) { - linfo->filter_size = linfo->shadow_render_data.stored_texel_size * max_filter_size * previous_box_filter_size; + linfo->filter_size = srd->stored_texel_size * max_filter_size * previous_box_filter_size; filter_pixel_size = max_ff(0.0f, filter_pixel_size - 3.0f); /* Compute number of concentric samples. Depends directly on filter size. */ float pix_size_sqr = filter_pixel_size * filter_pixel_size; @@ -1205,8 +1232,8 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl) DRW_uniformbuffer_update(sldata->shadow_render_ubo, &linfo->shadow_render_data); int layer = evscd->layer_id + linfo->current_shadow_cascade; - GPU_framebuffer_texture_layer_attach(sldata->shadow_store_fb, sldata->shadow_pool, 0, layer, 0); - GPU_framebuffer_bind(sldata->shadow_store_fb); + GPU_framebuffer_texture_layer_attach(sldata->shadow_cascade_store_fb, sldata->shadow_cascade_pool, 0, layer, 0); + GPU_framebuffer_bind(sldata->shadow_cascade_store_fb); DRW_draw_pass(psl->shadow_cascade_store_pass); } } diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 036fd041620..d7595b1a090 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -368,7 +368,8 @@ static void add_standard_uniforms( /* TODO if glossy or diffuse bsdf */ if (true) { DRW_shgroup_uniform_texture(shgrp, "utilTex", e_data.util_tex); - DRW_shgroup_uniform_texture_ref(shgrp, "shadowTexture", &sldata->shadow_pool); + DRW_shgroup_uniform_texture_ref(shgrp, "shadowCubeTexture", &sldata->shadow_cube_pool); + DRW_shgroup_uniform_texture_ref(shgrp, "shadowCascadeTexture", &sldata->shadow_cascade_pool); DRW_shgroup_uniform_texture_ref(shgrp, "maxzBuffer", &vedata->txl->maxzbuffer); if ((vedata->stl->effects->enabled_effects & EFFECT_GTAO) != 0) { diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index ec9cdf9b505..465e0d4d462 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -344,11 +344,12 @@ typedef struct EEVEE_ShadowCasterBuffer { /* ************ LIGHT DATA ************* */ typedef struct EEVEE_LampsInfo { int num_light, cache_num_light; - int num_layer, cache_num_layer; + int num_cube_layer, cache_num_cube_layer; + int num_cascade_layer, cache_num_cascade_layer; int gpu_cube_ct, gpu_cascade_ct, gpu_shadow_ct; int cpu_cube_ct, cpu_cascade_ct; int update_flag; - int shadow_size, shadow_method; + int shadow_cube_size, shadow_cascade_size, shadow_method; bool shadow_high_bitdepth; int shadow_cube_target_size; int current_shadow_cascade; @@ -645,14 +646,16 @@ typedef struct EEVEE_ViewLayerData { struct GPUUniformBuffer *shadow_samples_ubo; struct GPUFrameBuffer *shadow_cube_target_fb; + struct GPUFrameBuffer *shadow_cube_store_fb; struct GPUFrameBuffer *shadow_cascade_target_fb; - struct GPUFrameBuffer *shadow_store_fb; + struct GPUFrameBuffer *shadow_cascade_store_fb; struct GPUTexture *shadow_cube_target; struct GPUTexture *shadow_cube_blur; struct GPUTexture *shadow_cascade_target; struct GPUTexture *shadow_cascade_blur; - struct GPUTexture *shadow_pool; + struct GPUTexture *shadow_cube_pool; + struct GPUTexture *shadow_cascade_pool; struct EEVEE_ShadowCasterBuffer shcasters_buffers[2]; diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 7793764b230..2fc480ca36b 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -422,7 +422,8 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) grp = DRW_shgroup_empty_tri_batch_create(scatter_sh, psl->volumetric_scatter_ps, common_data->vol_tex_size[2]); DRW_shgroup_uniform_texture_ref(grp, "irradianceGrid", &sldata->irradiance_pool); - DRW_shgroup_uniform_texture_ref(grp, "shadowTexture", &sldata->shadow_pool); + DRW_shgroup_uniform_texture_ref(grp, "shadowCubeTexture", &sldata->shadow_cube_pool); + DRW_shgroup_uniform_texture_ref(grp, "shadowCascadeTexture", &sldata->shadow_cascade_pool); DRW_shgroup_uniform_texture_ref(grp, "volumeScattering", &txl->volume_prop_scattering); DRW_shgroup_uniform_texture_ref(grp, "volumeExtinction", &txl->volume_prop_extinction); DRW_shgroup_uniform_texture_ref(grp, "volumeEmission", &txl->volume_prop_emission); diff --git a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl index 432fa33b291..62f4c0c1c93 100644 --- a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl @@ -1,5 +1,6 @@ -uniform sampler2DArray shadowTexture; +uniform sampler2DArray shadowCubeTexture; +uniform sampler2DArray shadowCascadeTexture; #define LAMPS_LIB @@ -22,16 +23,16 @@ layout(std140) uniform light_block { #if defined(SHADOW_VSM) #define ShadowSample vec2 -#define sample_cube(vec, id) texture_octahedron(shadowTexture, vec4(vec, id)).rg -#define sample_cascade(vec, id) texture(shadowTexture, vec3(vec, id)).rg +#define sample_cube(vec, id) texture_octahedron(shadowCubeTexture, vec4(vec, id)).rg +#define sample_cascade(vec, id) texture(shadowCascadeTexture, vec3(vec, id)).rg #elif defined(SHADOW_ESM) #define ShadowSample float -#define sample_cube(vec, id) texture_octahedron(shadowTexture, vec4(vec, id)).r -#define sample_cascade(vec, id) texture(shadowTexture, vec3(vec, id)).r +#define sample_cube(vec, id) texture_octahedron(shadowCubeTexture, vec4(vec, id)).r +#define sample_cascade(vec, id) texture(shadowCascadeTexture, vec3(vec, id)).r #else #define ShadowSample float -#define sample_cube(vec, id) texture_octahedron(shadowTexture, vec4(vec, id)).r -#define sample_cascade(vec, id) texture(shadowTexture, vec3(vec, id)).r +#define sample_cube(vec, id) texture_octahedron(shadowCubeTexture, vec4(vec, id)).r +#define sample_cascade(vec, id) texture(shadowCascadeTexture, vec3(vec, id)).r #endif #if defined(SHADOW_VSM) |