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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-12 14:41:23 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-13 16:56:10 +0300
commit21854575a4ede7d0c16fbe31ac90e66493f607fe (patch)
tree1a196b314cbd7f5eedd16caef6d1de43b0cd2837 /intern/cycles/render/light.cpp
parent7ad802cf3ae500bc72863b6dba0f28a488fce3d1 (diff)
Cycles/Eevee: unify light strength and color
Cycles lights now use strength and color properties of the light outside of the shading nodes, just like Eevee. The shading nodes then act as a multiplier on this, and become optional unless textures, fallof or other effects are desired. Backwards compatibility is not exact, as we can't be sure which renderer the .blend was designed for or even if it was designed for a single one. If the render engine in the active scene is set to Cycles, lights are converted to ensure overall light strength remains the same, and removing unnecessary shader node setups that only included a single emission node. If the engine is set to Eevee, we increase strength to remove the automatic 100x multiplier that was there to match Cycles. Differential Revision: https://developer.blender.org/D4588
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r--intern/cycles/render/light.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index d4c233e3bb3..ef4bd4260c9 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -114,6 +114,8 @@ NODE_DEFINE(Light)
type_enum.insert("spot", LIGHT_SPOT);
SOCKET_ENUM(type, "Type", type_enum, LIGHT_POINT);
+ SOCKET_COLOR(strength, "Strength", make_float3(1.0f, 1.0f, 1.0f));
+
SOCKET_POINT(co, "Co", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_VECTOR(dir, "Dir", make_float3(0.0f, 0.0f, 0.0f));
@@ -162,6 +164,9 @@ void Light::tag_update(Scene *scene)
bool Light::has_contribution(Scene *scene)
{
+ if (strength == make_float3(0.0f, 0.0f, 0.0f)) {
+ return false;
+ }
if (is_portal) {
return false;
}
@@ -672,7 +677,6 @@ void LightManager::device_update_points(Device *, DeviceScene *dscene, Scene *sc
float3 co = light->co;
Shader *shader = (light->shader) ? light->shader : scene->default_light;
int shader_id = scene->shader_manager->get_shader_id(shader);
- int samples = light->samples;
int max_bounces = light->max_bounces;
float random = (float)light->random_id * (1.0f / (float)0xFFFFFFFF);
@@ -697,7 +701,10 @@ void LightManager::device_update_points(Device *, DeviceScene *dscene, Scene *sc
}
klights[light_index].type = light->type;
- klights[light_index].samples = samples;
+ klights[light_index].samples = light->samples;
+ klights[light_index].strength[0] = light->strength.x;
+ klights[light_index].strength[1] = light->strength.y;
+ klights[light_index].strength[2] = light->strength.z;
if (light->type == LIGHT_POINT) {
shader_id &= ~SHADER_AREA_LIGHT;