2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
2014-12-25 01:50:24 +00:00
|
|
|
* limitations under the License.
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LIGHT_H__
|
|
|
|
#define __LIGHT_H__
|
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 18:39:14 +00:00
|
|
|
#include "kernel/kernel_types.h"
|
2011-09-27 20:37:24 +00:00
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 18:39:14 +00:00
|
|
|
#include "graph/node.h"
|
2016-05-07 22:18:32 +00:00
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 18:39:14 +00:00
|
|
|
#include "util/util_types.h"
|
|
|
|
#include "util/util_vector.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
class DeviceScene;
|
2016-07-28 10:27:24 +00:00
|
|
|
class Object;
|
2011-04-27 11:58:34 +00:00
|
|
|
class Progress;
|
|
|
|
class Scene;
|
2016-05-07 22:18:32 +00:00
|
|
|
class Shader;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-05-07 22:18:32 +00:00
|
|
|
class Light : public Node {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2016-05-07 22:18:32 +00:00
|
|
|
NODE_DECLARE;
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
Light();
|
|
|
|
|
2011-09-27 20:37:24 +00:00
|
|
|
LightType type;
|
2011-04-27 11:58:34 +00:00
|
|
|
float3 co;
|
2011-09-27 20:37:24 +00:00
|
|
|
|
|
|
|
float3 dir;
|
|
|
|
float size;
|
|
|
|
|
|
|
|
float3 axisu;
|
|
|
|
float sizeu;
|
|
|
|
float3 axisv;
|
|
|
|
float sizev;
|
|
|
|
|
2016-10-29 16:54:42 +00:00
|
|
|
Transform tfm;
|
|
|
|
|
2012-01-20 17:49:17 +00:00
|
|
|
int map_resolution;
|
|
|
|
|
2012-06-04 17:17:10 +00:00
|
|
|
float spot_angle;
|
|
|
|
float spot_smooth;
|
|
|
|
|
2011-09-27 20:37:24 +00:00
|
|
|
bool cast_shadow;
|
2013-01-30 15:57:15 +00:00
|
|
|
bool use_mis;
|
2013-06-07 18:59:23 +00:00
|
|
|
bool use_diffuse;
|
|
|
|
bool use_glossy;
|
|
|
|
bool use_transmission;
|
2014-09-05 14:17:24 +00:00
|
|
|
bool use_scatter;
|
2011-09-27 20:37:24 +00:00
|
|
|
|
Cycles: Added support for light portals
This patch adds support for light portals: objects that help sampling the
environment light, therefore improving convergence. Using them tor other
lights in a unidirectional pathtracer is virtually useless.
The sampling is done with the area-preserving code already used for area lamps.
MIS is used both for combination of different portals and for combining portal-
and envmap-sampling.
The direction of portals is considered, they aren't used if the sampling point
is behind them.
Reviewers: sergey, dingto, #cycles
Reviewed By: dingto, #cycles
Subscribers: Lapineige, nutel, jtheninja, dsisco11, januz, vitorbalbio, candreacchio, TARDISMaker, lichtwerk, ace_dragon, marcog, mib2berlin, Tunge, lopataasdf, lordodin, sergey, dingto
Differential Revision: https://developer.blender.org/D1133
2015-04-27 19:51:55 +00:00
|
|
|
bool is_portal;
|
2016-02-06 21:21:38 +00:00
|
|
|
bool is_enabled;
|
Cycles: Added support for light portals
This patch adds support for light portals: objects that help sampling the
environment light, therefore improving convergence. Using them tor other
lights in a unidirectional pathtracer is virtually useless.
The sampling is done with the area-preserving code already used for area lamps.
MIS is used both for combination of different portals and for combining portal-
and envmap-sampling.
The direction of portals is considered, they aren't used if the sampling point
is behind them.
Reviewers: sergey, dingto, #cycles
Reviewed By: dingto, #cycles
Subscribers: Lapineige, nutel, jtheninja, dsisco11, januz, vitorbalbio, candreacchio, TARDISMaker, lichtwerk, ace_dragon, marcog, mib2berlin, Tunge, lopataasdf, lordodin, sergey, dingto
Differential Revision: https://developer.blender.org/D1133
2015-04-27 19:51:55 +00:00
|
|
|
|
2016-05-14 12:50:03 +00:00
|
|
|
Shader *shader;
|
2012-06-13 11:44:48 +00:00
|
|
|
int samples;
|
2014-11-05 21:48:45 +00:00
|
|
|
int max_bounces;
|
2017-11-05 20:59:17 +00:00
|
|
|
uint random_id;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
void tag_update(Scene *scene);
|
2015-06-25 15:00:32 +00:00
|
|
|
|
|
|
|
/* Check whether the light has contribution the the scene. */
|
|
|
|
bool has_contribution(Scene *scene);
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class LightManager {
|
|
|
|
public:
|
2013-06-08 13:43:38 +00:00
|
|
|
bool use_light_visibility;
|
2011-04-27 11:58:34 +00:00
|
|
|
bool need_update;
|
|
|
|
|
|
|
|
LightManager();
|
|
|
|
~LightManager();
|
|
|
|
|
2016-02-06 21:21:38 +00:00
|
|
|
void device_update(Device *device,
|
|
|
|
DeviceScene *dscene,
|
|
|
|
Scene *scene,
|
|
|
|
Progress& progress);
|
2011-04-27 11:58:34 +00:00
|
|
|
void device_free(Device *device, DeviceScene *dscene);
|
|
|
|
|
|
|
|
void tag_update(Scene *scene);
|
|
|
|
|
2016-09-02 07:58:41 +00:00
|
|
|
/* Check whether there is a background light. */
|
|
|
|
bool has_background_light(Scene *scene);
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
protected:
|
2016-02-06 21:21:38 +00:00
|
|
|
/* Optimization: disable light which is either unsupported or
|
|
|
|
* which doesn't contribute to the scene or which is only used for MIS
|
|
|
|
* and scene doesn't need MIS.
|
|
|
|
*/
|
|
|
|
void disable_ineffective_light(Device *device, Scene *scene);
|
2016-02-06 19:43:44 +00:00
|
|
|
|
|
|
|
void device_update_points(Device *device,
|
|
|
|
DeviceScene *dscene,
|
2016-02-06 21:21:38 +00:00
|
|
|
Scene *scene);
|
|
|
|
void device_update_distribution(Device *device,
|
|
|
|
DeviceScene *dscene,
|
|
|
|
Scene *scene,
|
|
|
|
Progress& progress);
|
2016-02-06 19:43:44 +00:00
|
|
|
void device_update_background(Device *device,
|
|
|
|
DeviceScene *dscene,
|
|
|
|
Scene *scene,
|
2016-02-06 21:21:38 +00:00
|
|
|
Progress& progress);
|
2016-07-28 10:27:24 +00:00
|
|
|
|
|
|
|
/* Check whether light manager can use the object as a light-emissive. */
|
|
|
|
bool object_usable_as_light(Object *object);
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif /* __LIGHT_H__ */
|
|
|
|
|