diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-09-04 17:22:47 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-09-06 09:35:14 +0300 |
commit | 1b287230a46d98f7cdfe6cbfd6c86e43c7e14968 (patch) | |
tree | 490cfa85d86d1cbd143534dfa515d49c02c0f15c /intern | |
parent | f8362836a5c8feff3715ca823025caba249208c2 (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 'intern')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 14 | ||||
-rw-r--r-- | intern/cycles/blender/blender_viewport.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/blender_viewport.h | 1 |
4 files changed, 16 insertions, 3 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 6f2794531fd..0af59411c5c 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -2086,6 +2086,7 @@ class CYCLES_VIEW3D_PT_shading_lighting(Panel): split = layout.split(factor=0.9) col = split.column() col.prop(shading, "studiolight_rotate_z", text="Rotation") + col.prop(shading, "studiolight_intensity") col.prop(shading, "studiolight_background_alpha") diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index f5a76002eb6..de04cc7714a 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -1347,6 +1347,14 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, texture_environment->filename = new_viewport_parameters.studiolight_path; graph->add(texture_environment); + MixNode *mix_intensity = new MixNode(); + mix_intensity->type = NODE_MIX_MUL; + mix_intensity->fac = 1.0f; + mix_intensity->color2 = make_float3(new_viewport_parameters.studiolight_intensity, + new_viewport_parameters.studiolight_intensity, + new_viewport_parameters.studiolight_intensity); + graph->add(mix_intensity); + TextureCoordinateNode *texture_coordinate = new TextureCoordinateNode(); graph->add(texture_coordinate); @@ -1359,10 +1367,10 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, graph->connect(texture_coordinate->output("Generated"), texture_environment->input("Vector")); + graph->connect(texture_environment->output("Color"), mix_intensity->input("Color1")); graph->connect(light_path->output("Is Camera Ray"), mix_scene_with_background->input("Fac")); - graph->connect(texture_environment->output("Color"), - mix_scene_with_background->input("Color1")); - graph->connect(texture_environment->output("Color"), + graph->connect(mix_intensity->output("Color"), mix_scene_with_background->input("Color1")); + graph->connect(mix_intensity->output("Color"), mix_background_with_environment->input("Color2")); graph->connect(mix_background_with_environment->output("Color"), mix_scene_with_background->input("Color2")); diff --git a/intern/cycles/blender/blender_viewport.cpp b/intern/cycles/blender/blender_viewport.cpp index 7af509aab09..93dd8faa450 100644 --- a/intern/cycles/blender/blender_viewport.cpp +++ b/intern/cycles/blender/blender_viewport.cpp @@ -21,6 +21,7 @@ BlenderViewportParameters::BlenderViewportParameters() : use_scene_world(true), use_scene_lights(true), studiolight_rotate_z(0.0f), + studiolight_intensity(1.0f), studiolight_background_alpha(1.0f), studiolight_path(ustring()) { @@ -36,6 +37,7 @@ BlenderViewportParameters::BlenderViewportParameters(BL::SpaceView3D &b_v3d) use_scene_lights = b_v3d.shading().use_scene_lights_render(); if (!use_scene_world) { studiolight_rotate_z = b_v3d.shading().studiolight_rotate_z(); + studiolight_intensity = b_v3d.shading().studiolight_intensity(); studiolight_background_alpha = b_v3d.shading().studiolight_background_alpha(); studiolight_path = b_v3d.shading().selected_studio_light().path(); } @@ -47,6 +49,7 @@ const bool BlenderViewportParameters::modified(const BlenderViewportParameters & { return use_scene_world != other.use_scene_world || use_scene_lights != other.use_scene_lights || studiolight_rotate_z != other.studiolight_rotate_z || + studiolight_intensity != other.studiolight_intensity || studiolight_background_alpha != other.studiolight_background_alpha || studiolight_path != other.studiolight_path; } diff --git a/intern/cycles/blender/blender_viewport.h b/intern/cycles/blender/blender_viewport.h index bb0d7d7f314..10e89f16e7b 100644 --- a/intern/cycles/blender/blender_viewport.h +++ b/intern/cycles/blender/blender_viewport.h @@ -31,6 +31,7 @@ class BlenderViewportParameters { bool use_scene_world; bool use_scene_lights; float studiolight_rotate_z; + float studiolight_intensity; float studiolight_background_alpha; ustring studiolight_path; |