diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-29 13:06:48 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-29 13:06:48 +0300 |
commit | 643259415dc5eea78bfac0fbaa5b148b39932a17 (patch) | |
tree | ca8b1d6bc09e9753064b28dbca995f3130c44347 | |
parent | a0b08e7b66fe9b271874d2f97d588d936d2d50f2 (diff) |
EEVEE: LookDev fade out background option
5 files changed, 18 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index c079467f8f5..00e22aaaae9 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3549,6 +3549,7 @@ class VIEW3D_PT_shading(Panel): col.row().template_icon_view(shading, "studio_light") if shading.studio_light_orientation == 'WORLD': col.row().prop(shading, "studiolight_rot_z") + col.row().prop(shading, "studiolight_fadeout") col.row().prop(shading, "use_scene_light") diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index e92cbe76472..80d3ff711af 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -36,7 +36,7 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShad EEVEE_StorageList *stl = vedata->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); View3D *v3d = draw_ctx->v3d; - if (v3d && v3d->drawtype == OB_MATERIAL) + if (LOOK_DEV_MODE_ENABLED(v3d)) { StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATION_WORLD); if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { @@ -61,6 +61,10 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShad pinfo->prev_wo_sh_compiled = false; pinfo->prev_world = NULL; } + else { + /* Do not fadeout when doing probe rendering, only when drawing the background */ + DRW_shgroup_uniform_float(*grp, "studioLightFadeout", &v3d->shading.studiolight_fadeout, 1); + } } } } diff --git a/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl b/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl index 472d9c577b4..9a1616648eb 100644 --- a/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl @@ -7,6 +7,7 @@ uniform mat4 ViewMatrixInverse; #ifdef LOOKDEV uniform mat3 StudioLightMatrix; uniform sampler2D image; +uniform float studioLightFadeout = 0.0; in vec3 viewPosition; #else uniform vec3 color; @@ -51,6 +52,7 @@ void main() { vec4 color; background_transform_to_world(viewPosition, worldvec); node_tex_environment_equirectangular(StudioLightMatrix * worldvec, image, color); + color *= (1.0 - studioLightFadeout); #endif FragColor = vec4(clamp(color.rgb, vec3(0.0), vec3(1e10)), backgroundAlpha); diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 1b9649095ac..8545e04cbdd 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -145,7 +145,7 @@ typedef struct View3DShading { float single_color[3]; float studiolight_rot_z; - float pad2; + float studiolight_fadeout; float object_outline_color[3]; float pad3; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index e5d08dcc8b5..e4107ee00ef 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2351,6 +2351,15 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 3); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "studiolight_fadeout", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "shading.studiolight_fadeout"); + RNA_def_property_float_default(prop, 0.0); + RNA_def_property_ui_text(prop, "Fadeout Background", "Fadeout the background rendering of the studiolight"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 3); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } static void rna_def_space_view3d_overlay(BlenderRNA *brna) |