Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2019-09-04 17:22:47 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-09-06 09:35:14 +0300
commit1b287230a46d98f7cdfe6cbfd6c86e43c7e14968 (patch)
tree490cfa85d86d1cbd143534dfa515d49c02c0f15c /source/blender/draw/engines/eevee
parentf8362836a5c8feff3715ca823025caba249208c2 (diff)
Viewport Shading: StudioLight Intensity
Add option to change the Intensity of the HDRI in the 3d viewport. This works for both EEVEE and Cycles Reviewed By: brecht, fclem Differential Revision: https://developer.blender.org/D5674
Diffstat (limited to 'source/blender/draw/engines/eevee')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lookdev.c5
-rw-r--r--source/blender/draw/engines/eevee/eevee_private.h1
-rw-r--r--source/blender/draw/engines/eevee/shaders/default_world_frag.glsl2
3 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c
index f52fcf31267..94d61a81fcc 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -151,6 +151,9 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
stl->g_data->studiolight_matrix, 'Z', v3d->shading.studiolight_rot_z);
DRW_shgroup_uniform_mat3(*grp, "StudioLightMatrix", stl->g_data->studiolight_matrix);
DRW_shgroup_uniform_float_copy(*grp, "backgroundAlpha", background_alpha);
+ DRW_shgroup_uniform_float(
+ *grp, "studioLightIntensity", &v3d->shading.studiolight_intensity, 1);
+
DRW_shgroup_uniform_vec3(*grp, "color", background_color, 1);
DRW_shgroup_call(*grp, geom, NULL);
if (!pinfo) {
@@ -170,12 +173,14 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
/* Do we need to recalc the lightprobes? */
if (g_data->studiolight_index != sl->index ||
g_data->studiolight_rot_z != v3d->shading.studiolight_rot_z ||
+ g_data->studiolight_intensity != v3d->shading.studiolight_intensity ||
g_data->studiolight_cubemap_res != scene->eevee.gi_cubemap_resolution ||
g_data->studiolight_glossy_clamp != scene->eevee.gi_glossy_clamp ||
g_data->studiolight_filter_quality != scene->eevee.gi_filter_quality) {
stl->lookdev_lightcache->flag |= LIGHTCACHE_UPDATE_WORLD;
g_data->studiolight_index = sl->index;
g_data->studiolight_rot_z = v3d->shading.studiolight_rot_z;
+ g_data->studiolight_intensity = v3d->shading.studiolight_intensity;
g_data->studiolight_cubemap_res = scene->eevee.gi_cubemap_resolution;
g_data->studiolight_glossy_clamp = scene->eevee.gi_glossy_clamp;
g_data->studiolight_filter_quality = scene->eevee.gi_filter_quality;
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index 28a8983cfee..f4f40d40de6 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -789,6 +789,7 @@ typedef struct EEVEE_PrivateData {
/* LookDev Settings */
int studiolight_index;
float studiolight_rot_z;
+ float studiolight_intensity;
int studiolight_cubemap_res;
float studiolight_glossy_clamp;
float studiolight_filter_quality;
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 70466479a29..41e103609f3 100644
--- a/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/default_world_frag.glsl
@@ -8,6 +8,7 @@ out vec4 FragColor;
uniform mat3 StudioLightMatrix;
uniform sampler2D image;
uniform float studioLightBackground = 1.0;
+uniform float studioLightIntensity = 1.0;
in vec3 viewPosition;
# define M_PI 3.14159265358979323846
@@ -51,6 +52,7 @@ void main()
#ifdef LOOKDEV
vec3 worldvec = background_transform_to_world(viewPosition);
background_color = node_tex_environment_equirectangular(StudioLightMatrix * worldvec, image).rgb;
+ background_color *= studioLightIntensity;
background_color = mix(color, background_color, studioLightBackground);
#else
background_color = color;