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
path: root/intern
diff options
context:
space:
mode:
authorTim Stullich <tstullich>2019-05-15 15:45:33 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-15 17:07:50 +0300
commit5ba1a6bee0426e77a01cec8c89999ee4d15ced63 (patch)
tree3f6fa2deef19c31f93c9d68d54814fa85bf5d52a /intern
parent2497ee31ec89560a9b72a070a70735caa6655b9e (diff)
Lights: change sun light size to be specified as angle
This is the angular diameter as seen from earth, which is between 0.526° and 0.545° in reality. Sharing the size with other light types did not make much sense and meant the unit was unclear. Differential Revision: https://developer.blender.org/D4819
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/addon/properties.py2
-rw-r--r--intern/cycles/blender/addon/ui.py4
-rw-r--r--intern/cycles/blender/blender_object.cpp2
-rw-r--r--intern/cycles/render/light.cpp19
-rw-r--r--intern/cycles/render/light.h1
5 files changed, 19 insertions, 9 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 6da88a769f5..f376eb8ec67 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1490,7 +1490,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
break
if not found_device:
- col = box.column(align=True);
+ col = box.column(align=True)
col.label(text="No compatible GPUs found for path tracing", icon='INFO')
col.label(text="Cycles will render on the CPU", icon='BLANK1')
return
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 9714067b08e..5ff88367f22 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1345,8 +1345,10 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
col.prop(light, "energy")
col.separator()
- if light.type in {'POINT', 'SUN', 'SPOT'}:
+ if light.type in {'POINT', 'SPOT'}:
col.prop(light, "shadow_soft_size", text="Size")
+ elif light.type == 'SUN':
+ col.prop(light, "angle")
elif light.type == 'AREA':
col.prop(light, "shape", text="Shape")
sub = col.column(align=True)
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 1094ff37afb..c07e896ab33 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -149,7 +149,7 @@ void BlenderSync::sync_light(BL::Object &b_parent,
// }
case BL::Light::type_SUN: {
BL::SunLight b_sun_light(b_light);
- light->size = b_sun_light.shadow_soft_size();
+ light->angle = b_sun_light.angle();
light->type = LIGHT_DISTANT;
break;
}
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index ef4bd4260c9..5c3f1c35bdc 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -398,11 +398,18 @@ void LightManager::device_update_distribution(Device *,
distribution[offset].lamp.size = light->size;
totarea += lightarea;
- if (light->size > 0.0f && light->use_mis)
- use_lamp_mis = true;
- if (light->type == LIGHT_BACKGROUND) {
+ if (light->type == LIGHT_DISTANT) {
+ use_lamp_mis |= (light->angle > 0.0f && light->use_mis);
+ }
+ else if (light->type == LIGHT_POINT || light->type == LIGHT_SPOT) {
+ use_lamp_mis |= (light->size > 0.0f && light->use_mis);
+ }
+ else if (light->type == LIGHT_AREA) {
+ use_lamp_mis |= light->use_mis;
+ }
+ else if (light->type == LIGHT_BACKGROUND) {
num_background_lights++;
- background_mis = light->use_mis;
+ background_mis |= light->use_mis;
}
light_index++;
@@ -725,8 +732,8 @@ void LightManager::device_update_points(Device *, DeviceScene *dscene, Scene *sc
else if (light->type == LIGHT_DISTANT) {
shader_id &= ~SHADER_AREA_LIGHT;
- float radius = light->size;
- float angle = atanf(radius);
+ float angle = light->angle / 2.0f;
+ float radius = tanf(angle);
float cosangle = cosf(angle);
float area = M_PI_F * radius * radius;
float invarea = (area > 0.0f) ? 1.0f / area : 1.0f;
diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h
index a7bffde7a8d..79450ea5f8d 100644
--- a/intern/cycles/render/light.h
+++ b/intern/cycles/render/light.h
@@ -47,6 +47,7 @@ class Light : public Node {
float3 dir;
float size;
+ float angle;
float3 axisu;
float sizeu;