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:
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/cycles/render/light.cpp
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/cycles/render/light.cpp')
-rw-r--r--intern/cycles/render/light.cpp19
1 files changed, 13 insertions, 6 deletions
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;