diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-21 09:56:54 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-21 10:02:12 +0300 |
commit | 032c741214b3db579f60941855711b482ed5794e (patch) | |
tree | 9a064df376e75ae0d32da44df16ee84eb75989ef /source/blender/draw/engines/eevee/eevee_lookdev.c | |
parent | 636a690eb13793583977598ca33ffa0289b32f46 (diff) |
Studiolight: Calculation of irradiance buffer
The calculation of the irradiance buffer was slow. Now it is only
calculated when it is being used (background_alpha > 0.0)
this solves the freeze when switching to LookDev mode.
Also changed the default calculation to use the Spherical Harmonics
calculation. This is able to generate the irradiance buffer fast, but is
less accurate. As the irradiance buffer is only used for visual
guidance speed is more important than accuracy.
Added compile directive to switch between the implementations.
(see STUDIOLIGHT_IRRADIANCE_METHOD)
Disabled caching the irradiance buffer when
STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS is used as it is not
needed.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_lookdev.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lookdev.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 806fb65b8e8..e083c9b5eb5 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -45,7 +45,7 @@ void EEVEE_lookdev_cache_init( StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_INTERNAL | STUDIOLIGHT_ORIENTATION_WORLD); if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get(); - GPUTexture *tex; + GPUTexture *tex = NULL; *grp = DRW_shgroup_create(shader, pass); axis_angle_to_mat3_single(stl->g_data->studiolight_matrix, 'Z', v3d->shading.studiolight_rot_z); @@ -59,15 +59,18 @@ void EEVEE_lookdev_cache_init( if (!pinfo) { /* Do not fadeout when doing probe rendering, only when drawing the background */ DRW_shgroup_uniform_float(*grp, "studioLightBackground", &v3d->shading.studiolight_background, 1); - - BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE); - tex = sl->equirectangular_irradiance_gputexture; + if (v3d->shading.studiolight_background > 0.0f) { + BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE); + tex = sl->equirectangular_irradiance_gputexture; + } } else { BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE); tex = sl->equirectangular_radiance_gputexture; } - DRW_shgroup_uniform_texture(*grp, "image", tex); + if (tex != NULL) { + DRW_shgroup_uniform_texture(*grp, "image", tex); + } /* Do we need to recalc the lightprobes? */ if (pinfo && |