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 02:50:24 +01: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 20:39:14 +02: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 20:39:14 +02:00
|
|
|
#include "graph/node.h"
|
2016-05-08 00:18:32 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
/* included as Light::set_shader defined through NODE_SOCKET_API does not select
|
|
|
|
|
* the right Node::set overload as it does not know that Shader is a Node */
|
|
|
|
|
#include "render/shader.h"
|
|
|
|
|
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
#include "util/util_ies.h"
|
|
|
|
|
#include "util/util_thread.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 20:39:14 +02: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 12:27:24 +02:00
|
|
|
class Object;
|
2011-04-27 11:58:34 +00:00
|
|
|
class Progress;
|
|
|
|
|
class Scene;
|
2016-05-08 00:18:32 +02:00
|
|
|
class Shader;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-05-08 00:18:32 +02:00
|
|
|
class Light : public Node {
|
2011-04-27 11:58:34 +00:00
|
|
|
public:
|
2016-05-08 00:18:32 +02:00
|
|
|
NODE_DECLARE;
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
Light();
|
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(LightType, light_type)
|
|
|
|
|
NODE_SOCKET_API(float3, strength)
|
|
|
|
|
NODE_SOCKET_API(float3, co)
|
2011-09-27 20:37:24 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, dir)
|
|
|
|
|
NODE_SOCKET_API(float, size)
|
|
|
|
|
NODE_SOCKET_API(float, angle)
|
2011-09-27 20:37:24 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float3, axisu)
|
|
|
|
|
NODE_SOCKET_API(float, sizeu)
|
|
|
|
|
NODE_SOCKET_API(float3, axisv)
|
|
|
|
|
NODE_SOCKET_API(float, sizev)
|
|
|
|
|
NODE_SOCKET_API(bool, round)
|
2021-04-01 05:35:56 +02:00
|
|
|
NODE_SOCKET_API(float, spread)
|
2011-09-27 20:37:24 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(Transform, tfm)
|
2016-10-29 18:54:42 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(int, map_resolution)
|
2012-01-20 17:49:17 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(float, spot_angle)
|
|
|
|
|
NODE_SOCKET_API(float, spot_smooth)
|
2012-06-04 17:17:10 +00:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(bool, cast_shadow)
|
|
|
|
|
NODE_SOCKET_API(bool, use_mis)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
NODE_SOCKET_API(bool, use_camera)
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(bool, use_diffuse)
|
|
|
|
|
NODE_SOCKET_API(bool, use_glossy)
|
|
|
|
|
NODE_SOCKET_API(bool, use_transmission)
|
|
|
|
|
NODE_SOCKET_API(bool, use_scatter)
|
2011-09-27 20:37:24 +00:00
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
NODE_SOCKET_API(bool, is_shadow_catcher)
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(bool, is_portal)
|
|
|
|
|
NODE_SOCKET_API(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-28 00:51:55 +05:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
NODE_SOCKET_API(Shader *, shader)
|
|
|
|
|
NODE_SOCKET_API(int, max_bounces)
|
|
|
|
|
NODE_SOCKET_API(uint, random_id)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
void tag_update(Scene *scene);
|
2015-06-25 17:00:32 +02:00
|
|
|
|
2019-11-25 00:55:11 +11:00
|
|
|
/* Check whether the light has contribution the scene. */
|
2015-06-25 17:00:32 +02:00
|
|
|
bool has_contribution(Scene *scene);
|
2020-11-04 11:17:38 +01:00
|
|
|
|
|
|
|
|
friend class LightManager;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LightManager {
|
|
|
|
|
public:
|
Cycles: optimize device updates
This optimizes device updates (during user edits or frame changes in
the viewport) by avoiding unnecessary computations. To achieve this,
we use a combination of the sockets' update flags as well as some new
flags passed to the various managers when tagging for an update to tell
exactly what the tagging is for (e.g. shader was modified, object was
removed, etc.).
Besides avoiding recomputations, we also avoid resending to the devices
unmodified data arrays, thus reducing bandwidth usage. For OptiX and
Embree, BVH packing was also multithreaded.
The performance improvements may vary depending on the used device (CPU
or GPU), and the content of the scene. Simple scenes (e.g. with no adaptive
subdivision or volumes) rendered using OptiX will benefit from this work
the most.
On average, for a variety of animated scenes, this gives a 3x speedup.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D9555
2021-01-22 15:01:26 +01:00
|
|
|
enum : uint32_t {
|
|
|
|
|
MESH_NEED_REBUILD = (1 << 0),
|
|
|
|
|
EMISSIVE_MESH_MODIFIED = (1 << 1),
|
|
|
|
|
LIGHT_MODIFIED = (1 << 2),
|
|
|
|
|
LIGHT_ADDED = (1 << 3),
|
|
|
|
|
LIGHT_REMOVED = (1 << 4),
|
|
|
|
|
OBJECT_MANAGER = (1 << 5),
|
|
|
|
|
SHADER_COMPILED = (1 << 6),
|
|
|
|
|
SHADER_MODIFIED = (1 << 7),
|
|
|
|
|
|
|
|
|
|
/* tag everything in the manager for an update */
|
|
|
|
|
UPDATE_ALL = ~0u,
|
|
|
|
|
|
|
|
|
|
UPDATE_NONE = 0u,
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-14 17:41:37 +02:00
|
|
|
/* Need to update background (including multiple importance map) */
|
|
|
|
|
bool need_update_background;
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
LightManager();
|
|
|
|
|
~LightManager();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
/* IES texture management */
|
2019-08-14 14:04:23 +02:00
|
|
|
int add_ies(const string &ies);
|
|
|
|
|
int add_ies_from_file(const string &filename);
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
void remove_ies(int slot);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-02-07 02:21:38 +05:00
|
|
|
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
|
2020-05-14 17:41:37 +02:00
|
|
|
void device_free(Device *device, DeviceScene *dscene, const bool free_background = true);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Cycles: optimize device updates
This optimizes device updates (during user edits or frame changes in
the viewport) by avoiding unnecessary computations. To achieve this,
we use a combination of the sockets' update flags as well as some new
flags passed to the various managers when tagging for an update to tell
exactly what the tagging is for (e.g. shader was modified, object was
removed, etc.).
Besides avoiding recomputations, we also avoid resending to the devices
unmodified data arrays, thus reducing bandwidth usage. For OptiX and
Embree, BVH packing was also multithreaded.
The performance improvements may vary depending on the used device (CPU
or GPU), and the content of the scene. Simple scenes (e.g. with no adaptive
subdivision or volumes) rendered using OptiX will benefit from this work
the most.
On average, for a variety of animated scenes, this gives a 3x speedup.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D9555
2021-01-22 15:01:26 +01:00
|
|
|
void tag_update(Scene *scene, uint32_t flag);
|
|
|
|
|
|
|
|
|
|
bool need_update() const;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-09-02 09:58:41 +02:00
|
|
|
/* Check whether there is a background light. */
|
|
|
|
|
bool has_background_light(Scene *scene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
protected:
|
2016-02-07 02:21:38 +05: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.
|
|
|
|
|
*/
|
2020-05-14 17:41:37 +02:00
|
|
|
void test_enabled_lights(Scene *scene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-02-06 20:43:44 +01:00
|
|
|
void device_update_points(Device *device, DeviceScene *dscene, Scene *scene);
|
2016-02-07 02:21:38 +05:00
|
|
|
void device_update_distribution(Device *device,
|
|
|
|
|
DeviceScene *dscene,
|
|
|
|
|
Scene *scene,
|
|
|
|
|
Progress &progress);
|
2016-02-06 20:43:44 +01:00
|
|
|
void device_update_background(Device *device,
|
|
|
|
|
DeviceScene *dscene,
|
|
|
|
|
Scene *scene,
|
2016-02-07 02:21:38 +05:00
|
|
|
Progress &progress);
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
void device_update_ies(DeviceScene *dscene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-07-28 12:27:24 +02:00
|
|
|
/* Check whether light manager can use the object as a light-emissive. */
|
|
|
|
|
bool object_usable_as_light(Object *object);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
struct IESSlot {
|
|
|
|
|
IESFile ies;
|
|
|
|
|
uint hash;
|
|
|
|
|
int users;
|
|
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Cycles: Add Support for IES files as textures for light strength
This patch adds support for IES files, a file format that is commonly used to store the directional intensity distribution of light sources.
The new IES node is supposed to be plugged into the Strength input of the Emission node of the lamp.
Since people generating IES files do not really seem to care about the standard, the parser is flexible enough to accept all test files I have tried.
Some common weirdnesses are distributing values over multiple lines that should go into one line, using commas instead of spaces as delimiters and adding various useless stuff at the end of the file.
The user interface of the node is similar to the script node, the user can either select an internal Text or load a file.
Internally, IES files are handled similar to Image textures: They are stored in slots by the LightManager and each unique IES is assigned to one slot.
The local coordinate system of the lamp is used, so that the direction of the light can be changed. For UI reasons, it's usually best to add an area light,
rotate it and then change its type, since especially the point light does not immediately show its local coordinate system in the viewport.
Reviewers: #cycles, dingto, sergey, brecht
Reviewed By: #cycles, dingto, brecht
Subscribers: OgDEV, crazyrobinhood, secundar, cardboard, pisuke, intrah, swerner, micah_denn, harvester, gottfried, disnel, campbellbarton, duarteframos, Lapineige, brecht, juicyfruit, dingto, marek, rickyblender, bliblubli, lockal, sergey
Differential Revision: https://developer.blender.org/D1543
2018-05-27 00:46:37 +02:00
|
|
|
vector<IESSlot *> ies_slots;
|
|
|
|
|
thread_mutex ies_mutex;
|
2020-05-14 17:41:37 +02:00
|
|
|
|
|
|
|
|
bool last_background_enabled;
|
|
|
|
|
int last_background_resolution;
|
Cycles: optimize device updates
This optimizes device updates (during user edits or frame changes in
the viewport) by avoiding unnecessary computations. To achieve this,
we use a combination of the sockets' update flags as well as some new
flags passed to the various managers when tagging for an update to tell
exactly what the tagging is for (e.g. shader was modified, object was
removed, etc.).
Besides avoiding recomputations, we also avoid resending to the devices
unmodified data arrays, thus reducing bandwidth usage. For OptiX and
Embree, BVH packing was also multithreaded.
The performance improvements may vary depending on the used device (CPU
or GPU), and the content of the scene. Simple scenes (e.g. with no adaptive
subdivision or volumes) rendered using OptiX will benefit from this work
the most.
On average, for a variety of animated scenes, this gives a 3x speedup.
Reviewed By: #cycles, brecht
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D9555
2021-01-22 15:01:26 +01:00
|
|
|
|
|
|
|
|
uint32_t update_flags;
|
2011-04-27 11:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
|
|
#endif /* __LIGHT_H__ */
|