diff options
Diffstat (limited to 'source')
4 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl index 4a1d88c29c1..c72df6b677d 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl @@ -106,7 +106,7 @@ void main() #endif #ifdef V3D_SHADING_SHADOW - float light_factor = -dot(normal_viewport, world_data.light_direction_vs.xyz); + float light_factor = -dot(normal_viewport, world_data.lights[0].light_direction_vs.xyz); /* The step function might be ok for meshes but it's * clearly not the case for hairs. Do smoothstep in this case. */ float shadow_mix = (diffuse_color.a == 1.0 || diffuse_color.a == 0.0) diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index b4a2330f173..efadf969830 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -155,8 +155,7 @@ void workbench_private_data_get_light_direction(WORKBENCH_PrivateData *wpd, floa copy_v3_v3(light_direction, scene->display.light_direction); negate_v3(light_direction); - - DRW_uniformbuffer_update(wpd->world_ubo, &wpd->world_data); + DRW_uniformbuffer_update(wpd->world_ubo, wd); } static void workbench_private_material_free(void *data) diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 3bf7c34d5eb..9b1a17a372a 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -49,7 +49,7 @@ /* *********** STATIC *********** */ -// #define DEBUG_SHADOW_VOLUME +/* #define DEBUG_SHADOW_VOLUME */ #ifdef DEBUG_SHADOW_VOLUME # include "draw_debug.h" @@ -76,7 +76,6 @@ static struct { struct GPUTexture *effect_buffer_tx; /* ref only, not alloced */ SceneDisplay display; /* world light direction for shadows */ - float light_direction_vs[3]; int next_object_id; float normal_world_matrix[3][3]; @@ -485,8 +484,6 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) WORKBENCH_PrivateData *wpd = stl->g_data; DRWShadingGroup *grp; const DRWContextState *draw_ctx = DRW_context_state_get(); - static float light_multiplier = 1.0f; - Scene *scene = draw_ctx->scene; @@ -494,9 +491,9 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) /* Deferred Mix Pass */ { workbench_private_data_get_light_direction(wpd, e_data.display.light_direction); + studiolight_update_light(wpd, e_data.display.light_direction); e_data.display.shadow_shift = scene->display.shadow_shift; - copy_v3_v3(e_data.light_direction_vs, wpd->world_data.lights[0].light_direction_vs); if (SHADOW_ENABLED(wpd)) { psl->composite_pass = DRW_pass_create( @@ -504,7 +501,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) grp = DRW_shgroup_create(wpd->composite_sh, psl->composite_pass); workbench_composite_uniforms(wpd, grp); DRW_shgroup_stencil_mask(grp, 0x00); - DRW_shgroup_uniform_float(grp, "lightMultiplier", &light_multiplier, 1); + DRW_shgroup_uniform_float_copy(grp, "lightMultiplier", 1.0f); DRW_shgroup_uniform_float(grp, "shadowMultiplier", &wpd->shadow_multiplier, 1); DRW_shgroup_uniform_float(grp, "shadowShift", &scene->display.shadow_shift, 1); DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL); @@ -548,7 +545,6 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL); #endif - studiolight_update_light(wpd, e_data.display.light_direction); } else { psl->composite_pass = DRW_pass_create( diff --git a/source/blender/draw/engines/workbench/workbench_studiolight.c b/source/blender/draw/engines/workbench/workbench_studiolight.c index e5e24cbb88a..f2453bf7070 100644 --- a/source/blender/draw/engines/workbench/workbench_studiolight.c +++ b/source/blender/draw/engines/workbench/workbench_studiolight.c @@ -121,6 +121,7 @@ static BoundBox *studiolight_object_shadow_bbox_get(WORKBENCH_PrivateData *wpd, for (int i = 0; i < 8; ++i) { mul_m4_v3(wpd->shadow_mat, oed->shadow_bbox.vec[i]); } + oed->shadow_bbox_dirty = false; } return &oed->shadow_bbox; |