2023-06-14 16:52:36 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2025-01-02 12:48:21 +01:00
|
|
|
#include "RNA_types.hh"
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "scene/background.h"
|
2024-12-26 17:53:59 +01:00
|
|
|
#include "scene/bake.h"
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "scene/camera.h"
|
|
|
|
|
#include "scene/curves.h"
|
|
|
|
|
#include "scene/film.h"
|
|
|
|
|
#include "scene/integrator.h"
|
|
|
|
|
#include "scene/light.h"
|
|
|
|
|
#include "scene/mesh.h"
|
|
|
|
|
#include "scene/object.h"
|
|
|
|
|
#include "scene/procedural.h"
|
|
|
|
|
#include "scene/scene.h"
|
|
|
|
|
#include "scene/shader.h"
|
|
|
|
|
#include "scene/shader_graph.h"
|
|
|
|
|
#include "scene/shader_nodes.h"
|
2011-04-27 11:58:34 +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 "device/device.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "blender/device.h"
|
|
|
|
|
#include "blender/session.h"
|
|
|
|
|
#include "blender/sync.h"
|
|
|
|
|
#include "blender/util.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2024-03-08 16:26:52 +01:00
|
|
|
#include "integrator/denoiser.h"
|
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/debug.h"
|
2024-12-26 19:41:25 +01:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/hash.h"
|
|
|
|
|
#include "util/log.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
2018-10-28 05:37:41 -04:00
|
|
|
static const char *cryptomatte_prefix = "Crypto";
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Constructor */
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
BlenderSync::BlenderSync(BL::RenderEngine &b_engine,
|
|
|
|
|
BL::BlendData &b_data,
|
|
|
|
|
BL::Scene &b_scene,
|
|
|
|
|
Scene *scene,
|
|
|
|
|
bool preview,
|
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
|
|
|
bool use_developer_ui,
|
2017-10-08 04:32:25 +02:00
|
|
|
Progress &progress)
|
2016-01-30 14:18:29 +01:00
|
|
|
: b_engine(b_engine),
|
|
|
|
|
b_data(b_data),
|
|
|
|
|
b_scene(b_scene),
|
2025-01-02 12:48:21 +01:00
|
|
|
b_bake_target(PointerRNA_NULL),
|
2020-10-29 14:40:29 +01:00
|
|
|
shader_map(scene),
|
|
|
|
|
object_map(scene),
|
2021-08-19 14:34:01 +02:00
|
|
|
procedural_map(scene),
|
2020-10-29 14:40:29 +01:00
|
|
|
geometry_map(scene),
|
|
|
|
|
particle_system_map(scene),
|
2024-12-26 17:53:55 +01:00
|
|
|
world_map(nullptr),
|
2011-12-01 16:33:21 +00:00
|
|
|
world_recalc(false),
|
2016-01-30 14:18:29 +01:00
|
|
|
scene(scene),
|
|
|
|
|
preview(preview),
|
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
|
|
|
use_developer_ui(use_developer_ui),
|
2016-04-17 20:15:50 +02:00
|
|
|
dicing_rate(1.0f),
|
2016-04-18 22:35:49 +02:00
|
|
|
max_subdivisions(12),
|
2024-12-26 17:53:59 +01:00
|
|
|
progress(progress)
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2016-04-17 20:15:50 +02:00
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
|
|
|
|
dicing_rate = preview ? RNA_float_get(&cscene, "preview_dicing_rate") :
|
|
|
|
|
RNA_float_get(&cscene, "dicing_rate");
|
2016-04-18 22:35:49 +02:00
|
|
|
max_subdivisions = RNA_int_get(&cscene, "max_subdivisions");
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-26 17:53:59 +01:00
|
|
|
BlenderSync::~BlenderSync() = default;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2020-05-27 18:00:59 +02:00
|
|
|
void BlenderSync::reset(BL::BlendData &b_data, BL::Scene &b_scene)
|
|
|
|
|
{
|
|
|
|
|
/* Update data and scene pointers in case they change in session reset,
|
2021-05-17 18:23:44 +02:00
|
|
|
* for example after undo.
|
|
|
|
|
* Note that we do not modify the `has_updates_` flag here because the sync
|
|
|
|
|
* reset is also used during viewport navigation. */
|
2020-05-27 18:00:59 +02:00
|
|
|
this->b_data = b_data;
|
|
|
|
|
this->b_scene = b_scene;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-15 20:25:41 +01:00
|
|
|
void BlenderSync::tag_update()
|
|
|
|
|
{
|
|
|
|
|
has_updates_ = true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-02 12:48:21 +01:00
|
|
|
void BlenderSync::set_bake_target(BL::Object &b_object)
|
|
|
|
|
{
|
|
|
|
|
b_bake_target = b_object;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Sync */
|
|
|
|
|
|
2019-08-27 15:47:30 +02:00
|
|
|
void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2018-05-29 15:57:14 +02:00
|
|
|
/* Sync recalc flags from blender to cycles. Actual update is done separate,
|
|
|
|
|
* so we can do it later on if doing it immediate is not suitable. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-12 02:21:37 +01:00
|
|
|
if (use_adaptive_subdivision) {
|
2019-04-04 20:06:22 +02:00
|
|
|
/* Mark all meshes as needing to be exported again if dicing changed. */
|
2016-09-18 12:04:12 -04:00
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
2019-04-04 20:06:22 +02:00
|
|
|
bool dicing_prop_changed = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-12-29 17:32:00 +01:00
|
|
|
const float updated_dicing_rate = preview ? RNA_float_get(&cscene, "preview_dicing_rate") :
|
|
|
|
|
RNA_float_get(&cscene, "dicing_rate");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-09-18 12:04:12 -04:00
|
|
|
if (dicing_rate != updated_dicing_rate) {
|
|
|
|
|
dicing_rate = updated_dicing_rate;
|
|
|
|
|
dicing_prop_changed = true;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-12-29 17:32:00 +01:00
|
|
|
const int updated_max_subdivisions = RNA_int_get(&cscene, "max_subdivisions");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-09-18 12:04:12 -04:00
|
|
|
if (max_subdivisions != updated_max_subdivisions) {
|
|
|
|
|
max_subdivisions = updated_max_subdivisions;
|
|
|
|
|
dicing_prop_changed = true;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-04 20:06:22 +02:00
|
|
|
if (dicing_prop_changed) {
|
2021-05-17 18:23:44 +02:00
|
|
|
has_updates_ = true;
|
|
|
|
|
|
2020-04-30 12:19:37 +02:00
|
|
|
for (const pair<const GeometryKey, Geometry *> &iter : geometry_map.key_to_scene_data()) {
|
2020-02-02 12:04:19 +01:00
|
|
|
Geometry *geom = iter.second;
|
2020-11-04 11:17:38 +01:00
|
|
|
if (geom->is_mesh()) {
|
2020-02-02 12:04:19 +01:00
|
|
|
Mesh *mesh = static_cast<Mesh *>(geom);
|
2020-11-04 11:17:38 +01:00
|
|
|
if (mesh->get_subdivision_type() != Mesh::SUBDIVISION_NONE) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const PointerRNA id_ptr = RNA_id_pointer_create((::ID *)iter.first.id);
|
2020-02-02 12:04:19 +01:00
|
|
|
geometry_map.set_recalc(BL::ID(id_ptr));
|
|
|
|
|
}
|
2019-04-04 20:06:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-09-18 12:04:12 -04:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-29 15:57:14 +02:00
|
|
|
/* Iterate over all IDs in this depsgraph. */
|
2021-01-25 16:20:10 +01:00
|
|
|
for (BL::DepsgraphUpdate &b_update : b_depsgraph.updates) {
|
2021-05-17 18:23:44 +02:00
|
|
|
/* TODO(sergey): Can do more selective filter here. For example, ignore changes made to
|
2024-08-19 11:54:36 +02:00
|
|
|
* screen data-block. Note that sync_data() needs to be called after object deletion, and
|
2021-05-17 18:23:44 +02:00
|
|
|
* currently this is ensured by the scene ID tagged for update, which sets the `has_updates_`
|
|
|
|
|
* flag. */
|
|
|
|
|
has_updates_ = true;
|
|
|
|
|
|
2021-01-25 16:20:10 +01:00
|
|
|
BL::ID b_id(b_update.id());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-29 15:57:14 +02:00
|
|
|
/* Material */
|
2018-11-15 17:19:26 +01:00
|
|
|
if (b_id.is_a(&RNA_Material)) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const BL::Material b_mat(b_id);
|
2018-05-29 15:57:14 +02:00
|
|
|
shader_map.set_recalc(b_mat);
|
|
|
|
|
}
|
2018-06-27 14:41:53 +02:00
|
|
|
/* Light */
|
2018-11-15 17:19:26 +01:00
|
|
|
else if (b_id.is_a(&RNA_Light)) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const BL::Light b_light(b_id);
|
2018-06-27 14:41:53 +02:00
|
|
|
shader_map.set_recalc(b_light);
|
2025-02-25 10:37:19 +01:00
|
|
|
geometry_map.set_recalc(b_light);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2018-05-29 15:57:14 +02:00
|
|
|
/* Object */
|
2018-11-15 17:19:26 +01:00
|
|
|
else if (b_id.is_a(&RNA_Object)) {
|
2018-05-30 15:21:21 +02:00
|
|
|
BL::Object b_ob(b_id);
|
2021-11-10 13:38:07 +01:00
|
|
|
const bool can_have_geometry = object_can_have_geometry(b_ob);
|
|
|
|
|
const bool is_light = !can_have_geometry && object_is_light(b_ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-25 16:20:10 +01:00
|
|
|
if (b_ob.is_instancer() && b_update.is_updated_shading()) {
|
2020-10-15 15:18:30 +02:00
|
|
|
/* Needed for e.g. object color updates on instancer. */
|
|
|
|
|
object_map.set_recalc(b_ob);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-10 13:38:07 +01:00
|
|
|
if (can_have_geometry || is_light) {
|
2021-01-25 16:20:10 +01:00
|
|
|
const bool updated_geometry = b_update.is_updated_geometry();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-09 18:54:42 +02:00
|
|
|
/* Geometry (mesh, hair, volume). */
|
2021-11-10 13:38:07 +01:00
|
|
|
if (can_have_geometry) {
|
2021-01-25 16:20:10 +01:00
|
|
|
if (b_update.is_updated_transform() || b_update.is_updated_shading()) {
|
2020-07-09 18:54:42 +02:00
|
|
|
object_map.set_recalc(b_ob);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 02:21:37 +01:00
|
|
|
const bool use_adaptive_subdiv = object_subdivision_type(
|
|
|
|
|
b_ob, preview, use_adaptive_subdivision) !=
|
|
|
|
|
Mesh::SUBDIVISION_NONE;
|
|
|
|
|
|
|
|
|
|
if (updated_geometry || use_adaptive_subdiv) {
|
|
|
|
|
BL::ID const key = BKE_object_is_modified(b_ob) ?
|
|
|
|
|
b_ob :
|
|
|
|
|
object_get_data(b_ob, use_adaptive_subdiv);
|
2020-07-09 18:54:42 +02:00
|
|
|
geometry_map.set_recalc(key);
|
2021-11-04 18:32:01 +01:00
|
|
|
|
|
|
|
|
/* Sync all contained geometry instances as well when the object changed.. */
|
2024-12-29 17:32:00 +01:00
|
|
|
const map<void *, set<BL::ID>>::const_iterator instance_geometries =
|
2021-11-04 18:32:01 +01:00
|
|
|
instance_geometries_by_object.find(b_ob.ptr.data);
|
|
|
|
|
if (instance_geometries != instance_geometries_by_object.end()) {
|
2025-02-05 16:26:55 +01:00
|
|
|
for (BL::ID const &geometry : instance_geometries->second) {
|
2021-11-04 18:32:01 +01:00
|
|
|
geometry_map.set_recalc(geometry);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-09 18:54:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (updated_geometry) {
|
|
|
|
|
BL::Object::particle_systems_iterator b_psys;
|
|
|
|
|
for (b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end();
|
2024-01-02 18:12:54 +01:00
|
|
|
++b_psys)
|
|
|
|
|
{
|
2020-07-09 18:54:42 +02:00
|
|
|
particle_system_map.set_recalc(b_ob);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-29 15:57:14 +02:00
|
|
|
}
|
2020-07-09 18:54:42 +02:00
|
|
|
/* Light */
|
|
|
|
|
else if (is_light) {
|
2021-01-25 16:20:10 +01:00
|
|
|
if (b_update.is_updated_transform() || b_update.is_updated_shading()) {
|
2020-07-09 18:54:42 +02:00
|
|
|
object_map.set_recalc(b_ob);
|
2025-02-24 23:44:14 +01:00
|
|
|
geometry_map.set_recalc(b_ob);
|
2020-07-09 18:54:42 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-09 18:54:42 +02:00
|
|
|
if (updated_geometry) {
|
2025-02-24 23:44:14 +01:00
|
|
|
geometry_map.set_recalc(b_ob);
|
2020-07-09 18:54:42 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
Attribute Node: support accessing attributes of View Layer and Scene.
The attribute node already allows accessing attributes associated
with objects and meshes, which allows changing the behavior of the
same material between different objects or instances. The same idea
can be extended to an even more global level of layers and scenes.
Currently view layers provide an option to replace all materials
with a different one. However, since the same material will be applied
to all objects in the layer, varying the behavior between layers while
preserving distinct materials requires duplicating objects.
Providing access to properties of layers and scenes via the attribute
node enables making materials with built-in switches or settings that
can be controlled globally at the view layer level. This is probably
most useful for complex NPR shading and compositing. Like with objects,
the node can also access built-in scene properties, like render resolution
or FOV of the active camera. Lookup is also attempted in World, similar
to how the Object mode checks the Mesh datablock.
In Cycles this mode is implemented by replacing the attribute node with
the attribute value during sync, allowing constant folding to take the
values into account. This means however that materials that use this
feature have to be re-synced upon any changes to scene, world or camera.
The Eevee version uses a new uniform buffer containing a sorted array
mapping name hashes to values, with binary search lookup. The array
is limited to 512 entries, which is effectively limitless even
considering it is shared by all materials in the scene; it is also
just 16KB of memory so no point trying to optimize further.
The buffer has to be rebuilt when new attributes are detected in a
material, so the draw engine keeps a table of recently seen attribute
names to minimize the chance of extra rebuilds mid-draw.
Differential Revision: https://developer.blender.org/D15941
2022-09-12 00:30:58 +03:00
|
|
|
else if (object_is_camera(b_ob)) {
|
|
|
|
|
shader_map.set_recalc(b_ob);
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2018-05-29 15:57:14 +02:00
|
|
|
/* Mesh */
|
2018-11-15 17:19:26 +01:00
|
|
|
else if (b_id.is_a(&RNA_Mesh)) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const BL::Mesh b_mesh(b_id);
|
2020-02-02 12:04:19 +01:00
|
|
|
geometry_map.set_recalc(b_mesh);
|
2011-09-27 20:37:24 +00:00
|
|
|
}
|
2018-05-29 15:57:14 +02:00
|
|
|
/* World */
|
2018-11-15 17:19:26 +01:00
|
|
|
else if (b_id.is_a(&RNA_World)) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const BL::World b_world(b_id);
|
2018-05-29 15:57:14 +02:00
|
|
|
if (world_map == b_world.ptr.data) {
|
|
|
|
|
world_recalc = true;
|
|
|
|
|
}
|
Attribute Node: support accessing attributes of View Layer and Scene.
The attribute node already allows accessing attributes associated
with objects and meshes, which allows changing the behavior of the
same material between different objects or instances. The same idea
can be extended to an even more global level of layers and scenes.
Currently view layers provide an option to replace all materials
with a different one. However, since the same material will be applied
to all objects in the layer, varying the behavior between layers while
preserving distinct materials requires duplicating objects.
Providing access to properties of layers and scenes via the attribute
node enables making materials with built-in switches or settings that
can be controlled globally at the view layer level. This is probably
most useful for complex NPR shading and compositing. Like with objects,
the node can also access built-in scene properties, like render resolution
or FOV of the active camera. Lookup is also attempted in World, similar
to how the Object mode checks the Mesh datablock.
In Cycles this mode is implemented by replacing the attribute node with
the attribute value during sync, allowing constant folding to take the
values into account. This means however that materials that use this
feature have to be re-synced upon any changes to scene, world or camera.
The Eevee version uses a new uniform buffer containing a sorted array
mapping name hashes to values, with binary search lookup. The array
is limited to 512 entries, which is effectively limitless even
considering it is shared by all materials in the scene; it is also
just 16KB of memory so no point trying to optimize further.
The buffer has to be rebuilt when new attributes are detected in a
material, so the draw engine keeps a table of recently seen attribute
names to minimize the chance of extra rebuilds mid-draw.
Differential Revision: https://developer.blender.org/D15941
2022-09-12 00:30:58 +03:00
|
|
|
shader_map.set_recalc(b_world);
|
|
|
|
|
}
|
|
|
|
|
/* World */
|
|
|
|
|
else if (b_id.is_a(&RNA_Scene)) {
|
|
|
|
|
shader_map.set_recalc(b_id);
|
2012-08-31 17:27:08 +00:00
|
|
|
}
|
2020-03-17 16:52:14 +01:00
|
|
|
/* Volume */
|
|
|
|
|
else if (b_id.is_a(&RNA_Volume)) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const BL::Volume b_volume(b_id);
|
2020-03-17 16:52:14 +01:00
|
|
|
geometry_map.set_recalc(b_volume);
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Render: faster animation and re-rendering with Persistent Data
For Cycles, when enabling the Persistent Data option, the full render data
will be preserved from frame-to-frame in animation renders and between
re-renders of the scene. This means that any modifier evaluation, BVH
building, OpenGL vertex buffer uploads, etc, can be done only once for
unchanged objects. This comes at an increased memory cost.
Previously there option was named Persistent Images and had a more limited
impact on render time and memory.
When using multiple view layers, only data from a single view layer is
preserved to keep memory usage somewhat under control. However objects
shared between view layers are preserved, and so this can speedup such
renders as well, even single frame renders.
For Eevee and Workbench this option is not available, however these engines
will now always reuse the depsgraph for animation and multiple view layers.
This can significantly speed up rendering.
These engines do not support sharing the depsgraph between re-renders, due
to technical issues regarding OpenGL contexts. Support for this could be added
if those are solved, see the code comments for details.
2021-04-04 23:51:24 +02:00
|
|
|
if (b_v3d) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const BlenderViewportParameters new_viewport_parameters(b_v3d, use_developer_ui);
|
2021-05-26 11:16:47 +02:00
|
|
|
|
2021-05-27 11:16:40 +02:00
|
|
|
if (viewport_parameters.shader_modified(new_viewport_parameters)) {
|
Render: faster animation and re-rendering with Persistent Data
For Cycles, when enabling the Persistent Data option, the full render data
will be preserved from frame-to-frame in animation renders and between
re-renders of the scene. This means that any modifier evaluation, BVH
building, OpenGL vertex buffer uploads, etc, can be done only once for
unchanged objects. This comes at an increased memory cost.
Previously there option was named Persistent Images and had a more limited
impact on render time and memory.
When using multiple view layers, only data from a single view layer is
preserved to keep memory usage somewhat under control. However objects
shared between view layers are preserved, and so this can speedup such
renders as well, even single frame renders.
For Eevee and Workbench this option is not available, however these engines
will now always reuse the depsgraph for animation and multiple view layers.
This can significantly speed up rendering.
These engines do not support sharing the depsgraph between re-renders, due
to technical issues regarding OpenGL contexts. Support for this could be added
if those are solved, see the code comments for details.
2021-04-04 23:51:24 +02:00
|
|
|
world_recalc = true;
|
2021-05-26 11:16:47 +02:00
|
|
|
has_updates_ = true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 11:31:03 +02:00
|
|
|
has_updates_ |= viewport_parameters.modified(new_viewport_parameters);
|
2019-08-27 15:47:30 +02:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
void BlenderSync::sync_data(BL::RenderSettings &b_render,
|
2018-06-25 12:39:30 +02:00
|
|
|
BL::Depsgraph &b_depsgraph,
|
2016-01-30 14:18:29 +01:00
|
|
|
BL::SpaceView3D &b_v3d,
|
|
|
|
|
BL::Object &b_override,
|
2025-01-01 18:15:54 +01:00
|
|
|
const int width,
|
|
|
|
|
const int height,
|
2024-03-08 16:26:52 +01:00
|
|
|
void **python_thread_state,
|
2024-06-24 11:28:02 +02:00
|
|
|
const DeviceInfo &denoise_device_info)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2022-03-01 19:45:36 +01:00
|
|
|
/* For auto refresh images. */
|
2024-12-29 23:13:45 +01:00
|
|
|
ImageManager *image_manager = scene->image_manager.get();
|
2022-03-01 19:45:36 +01:00
|
|
|
const int frame = b_scene.frame_current();
|
|
|
|
|
const bool auto_refresh_update = image_manager->set_animation_frame_update(frame);
|
|
|
|
|
|
|
|
|
|
if (!has_updates_ && !auto_refresh_update) {
|
2021-05-17 18:23:44 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-29 17:32:00 +01:00
|
|
|
const scoped_timer timer;
|
2020-09-18 12:03:22 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
|
2019-04-17 06:17:24 +02: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
|
|
|
/* TODO(sergey): This feels weak to pass view layer to the integrator, and even weaker to have an
|
|
|
|
|
* implicit check on whether it is a background render or not. What is the nicer thing here? */
|
|
|
|
|
const bool background = !b_v3d;
|
|
|
|
|
|
2021-05-26 10:45:27 +02:00
|
|
|
sync_view_layer(b_view_layer);
|
2024-06-24 11:28:02 +02:00
|
|
|
sync_integrator(b_view_layer, background, denoise_device_info);
|
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
|
|
|
sync_film(b_view_layer, b_v3d);
|
2022-03-01 19:45:36 +01:00
|
|
|
sync_shaders(b_depsgraph, b_v3d, auto_refresh_update);
|
2015-04-02 19:24:14 +05:00
|
|
|
sync_images();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-02 12:04:19 +01:00
|
|
|
geometry_synced.clear(); /* use for objects and motion sync */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-29 17:40:13 +02:00
|
|
|
if (scene->need_motion() == Scene::MOTION_PASS || scene->need_motion() == Scene::MOTION_NONE ||
|
2022-04-19 16:28:14 +02:00
|
|
|
scene->camera->get_motion_position() == MOTION_POSITION_CENTER)
|
|
|
|
|
{
|
2019-08-27 15:47:30 +02:00
|
|
|
sync_objects(b_depsgraph, b_v3d);
|
2015-06-29 17:40:13 +02:00
|
|
|
}
|
2019-08-27 15:47:30 +02:00
|
|
|
sync_motion(b_render, b_depsgraph, b_v3d, b_override, width, height, python_thread_state);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-02 12:04:19 +01:00
|
|
|
geometry_synced.clear();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-26 14:28:26 +02:00
|
|
|
/* Shader sync done at the end, since object sync uses it.
|
|
|
|
|
* false = don't delete unused shaders, not supported. */
|
2020-10-29 14:40:29 +01:00
|
|
|
shader_map.post_sync(false);
|
2019-06-26 14:28:26 +02:00
|
|
|
|
2022-06-16 19:39:13 +02:00
|
|
|
VLOG_INFO << "Total time spent synchronizing data: " << timer.get_time();
|
2021-05-17 18:23:44 +02:00
|
|
|
|
|
|
|
|
has_updates_ = false;
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Integrator */
|
|
|
|
|
|
2024-03-08 16:26:52 +01:00
|
|
|
void BlenderSync::sync_integrator(BL::ViewLayer &b_view_layer,
|
|
|
|
|
bool background,
|
2024-06-24 11:28:02 +02:00
|
|
|
const DeviceInfo &denoise_device_info)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-12 02:21:37 +01:00
|
|
|
/* No adaptive subdivision for baking, mesh needs to match Blender exactly. */
|
|
|
|
|
use_adaptive_subdivision = (get_enum(cscene, "feature_set") != 0) && !b_bake_target;
|
|
|
|
|
use_experimental_procedural = (get_enum(cscene, "feature_set") != 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
Integrator *integrator = scene->integrator;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_min_bounce(get_int(cscene, "min_light_bounces"));
|
|
|
|
|
integrator->set_max_bounce(get_int(cscene, "max_bounces"));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_max_diffuse_bounce(get_int(cscene, "diffuse_bounces"));
|
|
|
|
|
integrator->set_max_glossy_bounce(get_int(cscene, "glossy_bounces"));
|
|
|
|
|
integrator->set_max_transmission_bounce(get_int(cscene, "transmission_bounces"));
|
|
|
|
|
integrator->set_max_volume_bounce(get_int(cscene, "volume_bounces"));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_transparent_min_bounce(get_int(cscene, "min_transparent_bounces"));
|
|
|
|
|
integrator->set_transparent_max_bounce(get_int(cscene, "transparent_max_bounces"));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_volume_max_steps(get_int(cscene, "volume_max_steps"));
|
2024-12-29 17:32:00 +01:00
|
|
|
const float volume_step_rate = (preview) ? get_float(cscene, "volume_preview_step_rate") :
|
|
|
|
|
get_float(cscene, "volume_step_rate");
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_volume_step_rate(volume_step_rate);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_caustics_reflective(get_boolean(cscene, "caustics_reflective"));
|
|
|
|
|
integrator->set_caustics_refractive(get_boolean(cscene, "caustics_refractive"));
|
|
|
|
|
integrator->set_filter_glossy(get_float(cscene, "blur_glossy"));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
int seed = get_int(cscene, "seed");
|
2016-11-08 11:16:37 +01:00
|
|
|
if (get_boolean(cscene, "use_animated_seed")) {
|
2020-11-04 11:17:38 +01:00
|
|
|
seed = hash_uint2(b_scene.frame_current(), get_int(cscene, "seed"));
|
2016-11-16 15:12:31 +01:00
|
|
|
if (b_scene.frame_subframe() != 0.0f) {
|
|
|
|
|
/* TODO(sergey): Ideally should be some sort of hash_merge,
|
|
|
|
|
* but this is good enough for now.
|
|
|
|
|
*/
|
2020-11-04 11:17:38 +01:00
|
|
|
seed += hash_uint2((int)(b_scene.frame_subframe() * (float)INT_MAX),
|
|
|
|
|
get_int(cscene, "seed"));
|
2016-11-08 11:16:37 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_seed(seed);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_sample_clamp_direct(get_float(cscene, "sample_clamp_direct"));
|
|
|
|
|
integrator->set_sample_clamp_indirect(get_float(cscene, "sample_clamp_indirect"));
|
2012-11-15 21:52:17 +00:00
|
|
|
if (!preview) {
|
2021-06-25 18:29:17 +02:00
|
|
|
integrator->set_motion_blur(view_layer.use_motion_blur);
|
2012-11-15 21:52:17 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-12-29 17:32:00 +01:00
|
|
|
const bool use_light_tree = get_boolean(cscene, "use_light_tree");
|
2022-12-02 19:04:00 +01:00
|
|
|
integrator->set_use_light_tree(use_light_tree);
|
2023-02-21 16:50:06 +01:00
|
|
|
integrator->set_light_sampling_threshold(get_float(cscene, "light_sampling_threshold"));
|
2022-12-02 19:04:00 +01:00
|
|
|
|
|
|
|
|
if (integrator->use_light_tree_is_modified()) {
|
|
|
|
|
scene->light_manager->tag_update(scene, LightManager::UPDATE_ALL);
|
|
|
|
|
}
|
2020-11-04 11:17:38 +01:00
|
|
|
|
Cycles: Implement blue-noise dithered sampling
This patch implements blue-noise dithered sampling as described by Nathan Vegdahl (https://psychopath.io/post/2022_07_24_owen_scrambling_based_dithered_blue_noise_sampling), which in turn is based on "Screen-Space Blue-Noise Diffusion of Monte Carlo Sampling Error via Hierarchical Ordering of Pixels"(https://repository.kaust.edu.sa/items/1269ae24-2596-400b-a839-e54486033a93).
The basic idea is simple: Instead of generating independent sequences for each pixel by scrambling them, we use a single sequence for the entire image, with each pixel getting one chunk of the samples. The ordering across pixels is determined by hierarchical scrambling of the pixel's position along a space-filling curve, which ends up being pretty much the same operation as already used for the underlying sequence.
This results in a more high-frequency noise distribution, which appears smoother despite not being less noisy overall.
The main limitation at the moment is that the improvement is only clear if the full sample amount is used per pixel, so interactive preview rendering and adaptive sampling will not receive the benefit. One exception to this is that when using the new "Automatic" setting, the first sample in interactive rendering will also be blue-noise-distributed.
The sampling mode option is now exposed in the UI, with the three options being Blue Noise (the new mode), Classic (the previous Tabulated Sobol method) and the new default, Automatic (blue noise, with the additional property of ensuring the first sample is also blue-noise-distributed in interactive rendering). When debug mode is enabled, additional options appear, such as Sobol-Burley.
Note that the scrambling distance option is not compatible with the blue-noise pattern.
Pull Request: https://projects.blender.org/blender/blender/pulls/118479
2024-06-05 02:29:47 +02:00
|
|
|
SamplingPattern sampling_pattern = (SamplingPattern)get_enum(
|
|
|
|
|
cscene, "sampling_pattern", SAMPLING_NUM_PATTERNS, SAMPLING_PATTERN_TABULATED_SOBOL);
|
|
|
|
|
|
|
|
|
|
switch (sampling_pattern) {
|
|
|
|
|
case SAMPLING_PATTERN_AUTOMATIC:
|
2024-06-06 00:45:38 +02:00
|
|
|
if (!background) {
|
Cycles: Implement blue-noise dithered sampling
This patch implements blue-noise dithered sampling as described by Nathan Vegdahl (https://psychopath.io/post/2022_07_24_owen_scrambling_based_dithered_blue_noise_sampling), which in turn is based on "Screen-Space Blue-Noise Diffusion of Monte Carlo Sampling Error via Hierarchical Ordering of Pixels"(https://repository.kaust.edu.sa/items/1269ae24-2596-400b-a839-e54486033a93).
The basic idea is simple: Instead of generating independent sequences for each pixel by scrambling them, we use a single sequence for the entire image, with each pixel getting one chunk of the samples. The ordering across pixels is determined by hierarchical scrambling of the pixel's position along a space-filling curve, which ends up being pretty much the same operation as already used for the underlying sequence.
This results in a more high-frequency noise distribution, which appears smoother despite not being less noisy overall.
The main limitation at the moment is that the improvement is only clear if the full sample amount is used per pixel, so interactive preview rendering and adaptive sampling will not receive the benefit. One exception to this is that when using the new "Automatic" setting, the first sample in interactive rendering will also be blue-noise-distributed.
The sampling mode option is now exposed in the UI, with the three options being Blue Noise (the new mode), Classic (the previous Tabulated Sobol method) and the new default, Automatic (blue noise, with the additional property of ensuring the first sample is also blue-noise-distributed in interactive rendering). When debug mode is enabled, additional options appear, such as Sobol-Burley.
Note that the scrambling distance option is not compatible with the blue-noise pattern.
Pull Request: https://projects.blender.org/blender/blender/pulls/118479
2024-06-05 02:29:47 +02:00
|
|
|
/* For interactive rendering, ensure that the first sample is in itself
|
|
|
|
|
* blue-noise-distributed for smooth viewport navigation. */
|
|
|
|
|
sampling_pattern = SAMPLING_PATTERN_BLUE_NOISE_FIRST;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* For non-interactive rendering, default to a full blue-noise pattern. */
|
|
|
|
|
sampling_pattern = SAMPLING_PATTERN_BLUE_NOISE_PURE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SAMPLING_PATTERN_TABULATED_SOBOL:
|
|
|
|
|
case SAMPLING_PATTERN_BLUE_NOISE_PURE:
|
|
|
|
|
/* Always allowed. */
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
/* If not using developer UI, default to blue noise for "advanced" patterns. */
|
|
|
|
|
if (!use_developer_ui) {
|
|
|
|
|
sampling_pattern = SAMPLING_PATTERN_BLUE_NOISE_PURE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2023-09-27 20:31:14 +02:00
|
|
|
}
|
2024-06-06 00:45:38 +02:00
|
|
|
|
2025-01-02 12:48:21 +01:00
|
|
|
const bool is_vertex_baking = b_bake_target && b_scene.render().bake().target() !=
|
|
|
|
|
BL::BakeSettings::target_IMAGE_TEXTURES;
|
2024-06-06 00:45:38 +02:00
|
|
|
scene->bake_manager->set_use_seed(is_vertex_baking);
|
|
|
|
|
if (is_vertex_baking) {
|
|
|
|
|
/* When baking vertex colors, the "pixels" in the output are unrelated to their neighbors,
|
|
|
|
|
* so blue-noise sampling makes no sense. */
|
|
|
|
|
sampling_pattern = SAMPLING_PATTERN_TABULATED_SOBOL;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_sampling_pattern(sampling_pattern);
|
|
|
|
|
|
2022-03-15 16:08:10 +01:00
|
|
|
int samples = 1;
|
2021-10-27 14:14:43 +02:00
|
|
|
bool use_adaptive_sampling = false;
|
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
|
|
|
if (preview) {
|
2022-03-15 16:08:10 +01:00
|
|
|
samples = get_int(cscene, "preview_samples");
|
2021-10-27 14:14:43 +02:00
|
|
|
use_adaptive_sampling = RNA_boolean_get(&cscene, "use_preview_adaptive_sampling");
|
|
|
|
|
integrator->set_use_adaptive_sampling(use_adaptive_sampling);
|
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
|
|
|
integrator->set_adaptive_threshold(get_float(cscene, "preview_adaptive_threshold"));
|
|
|
|
|
integrator->set_adaptive_min_samples(get_int(cscene, "preview_adaptive_min_samples"));
|
2018-07-06 10:17:58 +02:00
|
|
|
}
|
2017-08-20 23:46:05 +02:00
|
|
|
else {
|
2022-03-15 16:08:10 +01:00
|
|
|
samples = get_int(cscene, "samples");
|
2021-10-27 14:14:43 +02:00
|
|
|
use_adaptive_sampling = RNA_boolean_get(&cscene, "use_adaptive_sampling");
|
|
|
|
|
integrator->set_use_adaptive_sampling(use_adaptive_sampling);
|
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
|
|
|
integrator->set_adaptive_threshold(get_float(cscene, "adaptive_threshold"));
|
|
|
|
|
integrator->set_adaptive_min_samples(get_int(cscene, "adaptive_min_samples"));
|
2017-08-20 23:46:05 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-10-26 08:30:15 +02:00
|
|
|
float scrambling_distance = get_float(cscene, "scrambling_distance");
|
2024-12-29 17:32:00 +01:00
|
|
|
const bool auto_scrambling_distance = get_boolean(cscene, "auto_scrambling_distance");
|
2021-11-22 15:56:51 +01:00
|
|
|
if (auto_scrambling_distance) {
|
2022-03-15 16:08:10 +01:00
|
|
|
if (samples == 0) {
|
|
|
|
|
/* If samples is 0, then viewport rendering is set to render infinitely. In that case we
|
|
|
|
|
* override the samples value with 4096 so the Automatic Scrambling Distance algorithm
|
|
|
|
|
* picks a Scrambling Distance value with a good balance of performance and correlation
|
|
|
|
|
* artifacts when rendering to high sample counts. */
|
|
|
|
|
samples = 4096;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (use_adaptive_sampling) {
|
|
|
|
|
/* If Adaptive Sampling is enabled, use "min_samples" in the Automatic Scrambling Distance
|
|
|
|
|
* algorithm to avoid artifacts common with Adaptive Sampling + Scrambling Distance. */
|
|
|
|
|
const AdaptiveSampling adaptive_sampling = integrator->get_adaptive_sampling();
|
|
|
|
|
samples = min(samples, adaptive_sampling.min_samples);
|
|
|
|
|
}
|
2021-10-26 08:30:15 +02:00
|
|
|
scrambling_distance *= 4.0f / sqrtf(samples);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-15 16:08:10 +01:00
|
|
|
/* Only use scrambling distance in the viewport if user wants to. */
|
2024-12-29 17:32:00 +01:00
|
|
|
const bool preview_scrambling_distance = get_boolean(cscene, "preview_scrambling_distance");
|
2022-08-29 16:41:49 +02:00
|
|
|
if ((preview && !preview_scrambling_distance) ||
|
Cycles: Implement blue-noise dithered sampling
This patch implements blue-noise dithered sampling as described by Nathan Vegdahl (https://psychopath.io/post/2022_07_24_owen_scrambling_based_dithered_blue_noise_sampling), which in turn is based on "Screen-Space Blue-Noise Diffusion of Monte Carlo Sampling Error via Hierarchical Ordering of Pixels"(https://repository.kaust.edu.sa/items/1269ae24-2596-400b-a839-e54486033a93).
The basic idea is simple: Instead of generating independent sequences for each pixel by scrambling them, we use a single sequence for the entire image, with each pixel getting one chunk of the samples. The ordering across pixels is determined by hierarchical scrambling of the pixel's position along a space-filling curve, which ends up being pretty much the same operation as already used for the underlying sequence.
This results in a more high-frequency noise distribution, which appears smoother despite not being less noisy overall.
The main limitation at the moment is that the improvement is only clear if the full sample amount is used per pixel, so interactive preview rendering and adaptive sampling will not receive the benefit. One exception to this is that when using the new "Automatic" setting, the first sample in interactive rendering will also be blue-noise-distributed.
The sampling mode option is now exposed in the UI, with the three options being Blue Noise (the new mode), Classic (the previous Tabulated Sobol method) and the new default, Automatic (blue noise, with the additional property of ensuring the first sample is also blue-noise-distributed in interactive rendering). When debug mode is enabled, additional options appear, such as Sobol-Burley.
Note that the scrambling distance option is not compatible with the blue-noise pattern.
Pull Request: https://projects.blender.org/blender/blender/pulls/118479
2024-06-05 02:29:47 +02:00
|
|
|
sampling_pattern != SAMPLING_PATTERN_TABULATED_SOBOL)
|
2024-01-02 18:12:54 +01:00
|
|
|
{
|
2021-10-26 08:30:15 +02:00
|
|
|
scrambling_distance = 1.0f;
|
2022-03-15 16:08:10 +01:00
|
|
|
}
|
2021-10-26 08:30:15 +02:00
|
|
|
|
2021-10-31 13:30:56 +01:00
|
|
|
if (scrambling_distance != 1.0f) {
|
2022-06-16 19:39:13 +02:00
|
|
|
VLOG_INFO << "Using scrambling distance: " << scrambling_distance;
|
2021-10-31 13:30:56 +01:00
|
|
|
}
|
2021-10-26 08:30:15 +02:00
|
|
|
integrator->set_scrambling_distance(scrambling_distance);
|
|
|
|
|
|
2021-04-04 15:01:00 +02:00
|
|
|
if (get_boolean(cscene, "use_fast_gi")) {
|
2016-11-25 18:59:43 +01:00
|
|
|
if (preview) {
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_ao_bounces(get_int(cscene, "ao_bounces"));
|
2016-11-25 18:59:43 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_ao_bounces(get_int(cscene, "ao_bounces_render"));
|
2016-11-25 18:59:43 +01:00
|
|
|
}
|
|
|
|
|
}
|
2017-05-23 10:34:03 +02:00
|
|
|
else {
|
2020-11-04 11:17:38 +01:00
|
|
|
integrator->set_ao_bounces(0);
|
2017-05-23 10:34:03 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-11-17 17:26:46 +01:00
|
|
|
#ifdef WITH_CYCLES_DEBUG
|
|
|
|
|
DirectLightSamplingType direct_light_sampling_type = (DirectLightSamplingType)get_enum(
|
|
|
|
|
cscene, "direct_light_sampling_type", DIRECT_LIGHT_SAMPLING_NUM, DIRECT_LIGHT_SAMPLING_MIS);
|
|
|
|
|
integrator->set_direct_light_sampling_type(direct_light_sampling_type);
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-09-21 17:58:34 +02:00
|
|
|
integrator->set_use_guiding(get_boolean(cscene, "use_guiding"));
|
|
|
|
|
integrator->set_use_surface_guiding(get_boolean(cscene, "use_surface_guiding"));
|
|
|
|
|
integrator->set_use_volume_guiding(get_boolean(cscene, "use_volume_guiding"));
|
|
|
|
|
integrator->set_guiding_training_samples(get_int(cscene, "guiding_training_samples"));
|
|
|
|
|
|
|
|
|
|
if (use_developer_ui) {
|
|
|
|
|
integrator->set_deterministic_guiding(get_boolean(cscene, "use_deterministic_guiding"));
|
|
|
|
|
integrator->set_surface_guiding_probability(get_float(cscene, "surface_guiding_probability"));
|
|
|
|
|
integrator->set_volume_guiding_probability(get_float(cscene, "volume_guiding_probability"));
|
|
|
|
|
integrator->set_use_guiding_direct_light(get_boolean(cscene, "use_guiding_direct_light"));
|
|
|
|
|
integrator->set_use_guiding_mis_weights(get_boolean(cscene, "use_guiding_mis_weights"));
|
2024-12-29 17:32:00 +01:00
|
|
|
const GuidingDistributionType guiding_distribution_type = (GuidingDistributionType)get_enum(
|
2022-09-21 17:58:34 +02:00
|
|
|
cscene, "guiding_distribution_type", GUIDING_NUM_TYPES, GUIDING_TYPE_PARALLAX_AWARE_VMM);
|
|
|
|
|
integrator->set_guiding_distribution_type(guiding_distribution_type);
|
2024-12-29 17:32:00 +01:00
|
|
|
const GuidingDirectionalSamplingType guiding_directional_sampling_type =
|
2023-05-09 15:06:34 +02:00
|
|
|
(GuidingDirectionalSamplingType)get_enum(cscene,
|
|
|
|
|
"guiding_directional_sampling_type",
|
|
|
|
|
GUIDING_DIRECTIONAL_SAMPLING_NUM_TYPES,
|
|
|
|
|
GUIDING_DIRECTIONAL_SAMPLING_TYPE_RIS);
|
|
|
|
|
integrator->set_guiding_directional_sampling_type(guiding_directional_sampling_type);
|
|
|
|
|
integrator->set_guiding_roughness_threshold(get_float(cscene, "guiding_roughness_threshold"));
|
2022-09-21 17:58:34 +02:00
|
|
|
}
|
|
|
|
|
|
2024-03-08 16:26:52 +01:00
|
|
|
DenoiseParams denoise_params = get_denoise_params(
|
2024-06-24 11:28:02 +02:00
|
|
|
b_scene, b_view_layer, background, denoise_device_info);
|
2022-08-04 19:28:09 +02:00
|
|
|
|
|
|
|
|
/* No denoising support for vertex color baking, vertices packed into image
|
|
|
|
|
* buffer have no relation to neighbors. */
|
Cycles: Implement blue-noise dithered sampling
This patch implements blue-noise dithered sampling as described by Nathan Vegdahl (https://psychopath.io/post/2022_07_24_owen_scrambling_based_dithered_blue_noise_sampling), which in turn is based on "Screen-Space Blue-Noise Diffusion of Monte Carlo Sampling Error via Hierarchical Ordering of Pixels"(https://repository.kaust.edu.sa/items/1269ae24-2596-400b-a839-e54486033a93).
The basic idea is simple: Instead of generating independent sequences for each pixel by scrambling them, we use a single sequence for the entire image, with each pixel getting one chunk of the samples. The ordering across pixels is determined by hierarchical scrambling of the pixel's position along a space-filling curve, which ends up being pretty much the same operation as already used for the underlying sequence.
This results in a more high-frequency noise distribution, which appears smoother despite not being less noisy overall.
The main limitation at the moment is that the improvement is only clear if the full sample amount is used per pixel, so interactive preview rendering and adaptive sampling will not receive the benefit. One exception to this is that when using the new "Automatic" setting, the first sample in interactive rendering will also be blue-noise-distributed.
The sampling mode option is now exposed in the UI, with the three options being Blue Noise (the new mode), Classic (the previous Tabulated Sobol method) and the new default, Automatic (blue noise, with the additional property of ensuring the first sample is also blue-noise-distributed in interactive rendering). When debug mode is enabled, additional options appear, such as Sobol-Burley.
Note that the scrambling distance option is not compatible with the blue-noise pattern.
Pull Request: https://projects.blender.org/blender/blender/pulls/118479
2024-06-05 02:29:47 +02:00
|
|
|
if (is_vertex_baking) {
|
2022-08-04 19:28:09 +02:00
|
|
|
denoise_params.use = false;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
integrator->set_use_denoise(denoise_params.use);
|
|
|
|
|
|
|
|
|
|
/* Only update denoiser parameters if the denoiser is actually used. This allows to tweak
|
|
|
|
|
* denoiser parameters before enabling it without render resetting on every change. The downside
|
|
|
|
|
* is that the interface and the integrator are technically out of sync. */
|
|
|
|
|
if (denoise_params.use) {
|
|
|
|
|
integrator->set_denoiser_type(denoise_params.type);
|
2024-02-06 17:46:21 +01:00
|
|
|
integrator->set_denoise_use_gpu(denoise_params.use_gpu);
|
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
|
|
|
integrator->set_denoise_start_sample(denoise_params.start_sample);
|
|
|
|
|
integrator->set_use_denoise_pass_albedo(denoise_params.use_pass_albedo);
|
|
|
|
|
integrator->set_use_denoise_pass_normal(denoise_params.use_pass_normal);
|
|
|
|
|
integrator->set_denoiser_prefilter(denoise_params.prefilter);
|
2024-02-06 20:46:48 +01:00
|
|
|
integrator->set_denoiser_quality(denoise_params.quality);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* UPDATE_NONE as we don't want to tag the integrator as modified (this was done by the
|
|
|
|
|
* set calls above), but we need to make sure that the dependent things are tagged. */
|
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
|
|
|
integrator->tag_update(scene, Integrator::UPDATE_NONE);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Film */
|
|
|
|
|
|
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
|
|
|
void BlenderSync::sync_film(BL::ViewLayer &b_view_layer, BL::SpaceView3D &b_v3d)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
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
|
|
|
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
Film *film = scene->film;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-05 12:47:20 +02:00
|
|
|
if (b_v3d) {
|
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
|
|
|
const BlenderViewportParameters new_viewport_parameters(b_v3d, use_developer_ui);
|
|
|
|
|
film->set_display_pass(new_viewport_parameters.display_pass);
|
|
|
|
|
film->set_show_active_pixels(new_viewport_parameters.show_active_pixels);
|
2019-09-05 12:47:20 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
film->set_exposure(get_float(cscene, "film_exposure"));
|
|
|
|
|
film->set_filter_type(
|
|
|
|
|
(FilterType)get_enum(cscene, "pixel_filter_type", FILTER_NUM_TYPES, FILTER_BLACKMAN_HARRIS));
|
2024-12-29 17:32:00 +01:00
|
|
|
const float filter_width = (film->get_filter_type() == FILTER_BOX) ?
|
|
|
|
|
1.0f :
|
|
|
|
|
get_float(cscene, "filter_width");
|
2020-11-04 11:17:38 +01:00
|
|
|
film->set_filter_width(filter_width);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-06-09 18:05:53 +00:00
|
|
|
if (b_scene.world()) {
|
|
|
|
|
BL::WorldMistSettings b_mist = b_scene.world().mist_settings();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
film->set_mist_start(b_mist.start());
|
|
|
|
|
film->set_mist_depth(b_mist.depth());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-06-09 18:05:53 +00:00
|
|
|
switch (b_mist.falloff()) {
|
|
|
|
|
case BL::WorldMistSettings::falloff_QUADRATIC:
|
2020-11-04 11:17:38 +01:00
|
|
|
film->set_mist_falloff(2.0f);
|
2013-06-09 18:05:53 +00:00
|
|
|
break;
|
|
|
|
|
case BL::WorldMistSettings::falloff_LINEAR:
|
2020-11-04 11:17:38 +01:00
|
|
|
film->set_mist_falloff(1.0f);
|
2013-06-09 18:05:53 +00:00
|
|
|
break;
|
|
|
|
|
case BL::WorldMistSettings::falloff_INVERSE_QUADRATIC:
|
2020-11-04 11:17:38 +01:00
|
|
|
film->set_mist_falloff(0.5f);
|
2013-06-09 18:05:53 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2013-06-07 12:45:26 +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
|
|
|
|
|
|
|
|
/* Blender viewport does not support proper shadow catcher compositing, so force an approximate
|
|
|
|
|
* mode to improve visual feedback. */
|
|
|
|
|
if (b_v3d) {
|
|
|
|
|
film->set_use_approximate_shadow_catcher(true);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
film->set_use_approximate_shadow_catcher(!get_boolean(crl, "use_pass_shadow_catcher"));
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2011-09-12 13:13:56 +00:00
|
|
|
/* Render Layer */
|
|
|
|
|
|
2021-05-26 10:45:27 +02:00
|
|
|
void BlenderSync::sync_view_layer(BL::ViewLayer &b_view_layer)
|
2011-09-12 13:13:56 +00:00
|
|
|
{
|
2018-02-26 16:46:48 +01:00
|
|
|
view_layer.name = b_view_layer.name();
|
2020-10-01 14:28:29 +02:00
|
|
|
|
|
|
|
|
/* Filter. */
|
2018-02-26 16:46:48 +01:00
|
|
|
view_layer.use_background_shader = b_view_layer.use_sky();
|
2020-10-01 14:28:29 +02:00
|
|
|
/* Always enable surfaces for baking, otherwise there is nothing to bake to. */
|
2025-01-02 12:48:21 +01:00
|
|
|
view_layer.use_surfaces = b_view_layer.use_solid() || b_bake_target;
|
2018-02-26 16:46:48 +01:00
|
|
|
view_layer.use_hair = b_view_layer.use_strand();
|
2020-03-11 11:22:13 +01:00
|
|
|
view_layer.use_volumes = b_view_layer.use_volumes();
|
2021-06-25 18:29:17 +02:00
|
|
|
view_layer.use_motion_blur = b_view_layer.use_motion_blur() &&
|
|
|
|
|
b_scene.render().use_motion_blur();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-28 18:37:05 +01:00
|
|
|
/* Material override. */
|
|
|
|
|
view_layer.material_override = b_view_layer.material_override();
|
2024-02-09 12:16:16 +01:00
|
|
|
/* World override. */
|
|
|
|
|
view_layer.world_override = b_view_layer.world_override();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-28 18:37:05 +01:00
|
|
|
/* Sample override. */
|
|
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
2024-12-29 17:32:00 +01:00
|
|
|
const int use_layer_samples = get_enum(cscene, "use_layer_samples");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-28 18:37:05 +01:00
|
|
|
view_layer.bound_samples = (use_layer_samples == 1);
|
|
|
|
|
view_layer.samples = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-28 18:37:05 +01:00
|
|
|
if (use_layer_samples != 2) {
|
2024-12-29 17:32:00 +01:00
|
|
|
const int samples = b_view_layer.samples();
|
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
|
|
|
view_layer.samples = samples;
|
2018-12-28 18:37:05 +01:00
|
|
|
}
|
2011-09-12 13:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-02 19:24:14 +05:00
|
|
|
/* Images */
|
|
|
|
|
void BlenderSync::sync_images()
|
|
|
|
|
{
|
|
|
|
|
/* Sync is a convention for this API, but currently it frees unused buffers. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-04-02 19:24:14 +05:00
|
|
|
const bool is_interface_locked = b_engine.render() && b_engine.render().use_lock_interface();
|
|
|
|
|
if (is_interface_locked == false && BlenderSession::headless == false) {
|
|
|
|
|
/* If interface is not locked, it's possible image is needed for
|
|
|
|
|
* the display.
|
|
|
|
|
*/
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Free buffers used by images which are not needed for render. */
|
2021-01-25 16:20:10 +01:00
|
|
|
for (BL::Image &b_image : b_data.images) {
|
2024-09-19 00:40:30 +02:00
|
|
|
const bool is_builtin = image_is_builtin(b_image, b_engine);
|
2015-04-02 19:24:14 +05:00
|
|
|
if (is_builtin == false) {
|
2021-01-25 16:20:10 +01:00
|
|
|
b_image.buffers_free();
|
2015-04-02 19:24:14 +05:00
|
|
|
}
|
|
|
|
|
/* TODO(sergey): Free builtin images not used by any shader. */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
/* Passes */
|
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
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
static bool get_known_pass_type(BL::RenderPass &b_pass, PassType &type, PassMode &mode)
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
{
|
2024-12-29 17:32:00 +01:00
|
|
|
const string name = b_pass.name();
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
#define MAP_PASS(passname, passtype, noisy) \
|
2020-09-19 16:01:32 +10:00
|
|
|
if (name == passname) { \
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
type = passtype; \
|
|
|
|
|
mode = (noisy) ? PassMode::NOISY : PassMode::DENOISED; \
|
|
|
|
|
return true; \
|
2020-09-19 16:01:32 +10:00
|
|
|
} \
|
|
|
|
|
((void)0)
|
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
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
/* NOTE: Keep in sync with defined names from engine.py */
|
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
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("Combined", PASS_COMBINED, false);
|
|
|
|
|
MAP_PASS("Noisy Image", PASS_COMBINED, true);
|
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
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("Depth", PASS_DEPTH, false);
|
|
|
|
|
MAP_PASS("Mist", PASS_MIST, false);
|
|
|
|
|
MAP_PASS("Position", PASS_POSITION, false);
|
|
|
|
|
MAP_PASS("Normal", PASS_NORMAL, false);
|
|
|
|
|
MAP_PASS("IndexOB", PASS_OBJECT_ID, false);
|
|
|
|
|
MAP_PASS("UV", PASS_UV, false);
|
|
|
|
|
MAP_PASS("Vector", PASS_MOTION, false);
|
|
|
|
|
MAP_PASS("IndexMA", PASS_MATERIAL_ID, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("DiffDir", PASS_DIFFUSE_DIRECT, false);
|
|
|
|
|
MAP_PASS("GlossDir", PASS_GLOSSY_DIRECT, false);
|
|
|
|
|
MAP_PASS("TransDir", PASS_TRANSMISSION_DIRECT, false);
|
|
|
|
|
MAP_PASS("VolumeDir", PASS_VOLUME_DIRECT, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("DiffInd", PASS_DIFFUSE_INDIRECT, false);
|
|
|
|
|
MAP_PASS("GlossInd", PASS_GLOSSY_INDIRECT, false);
|
|
|
|
|
MAP_PASS("TransInd", PASS_TRANSMISSION_INDIRECT, false);
|
|
|
|
|
MAP_PASS("VolumeInd", PASS_VOLUME_INDIRECT, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("DiffCol", PASS_DIFFUSE_COLOR, false);
|
|
|
|
|
MAP_PASS("GlossCol", PASS_GLOSSY_COLOR, false);
|
|
|
|
|
MAP_PASS("TransCol", PASS_TRANSMISSION_COLOR, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("Emit", PASS_EMISSION, false);
|
|
|
|
|
MAP_PASS("Env", PASS_BACKGROUND, false);
|
|
|
|
|
MAP_PASS("AO", PASS_AO, false);
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE, false);
|
2024-06-06 00:45:38 +02:00
|
|
|
MAP_PASS("BakeSeed", PASS_BAKE_SEED, false);
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("BakeDifferential", PASS_BAKE_DIFFERENTIAL, false);
|
Cycles: code refactor to bake using regular render session and tiles
There should be no user visible change from this, except that tile size
now affects performance. The goal here is to simplify bake denoising in
D3099, letting it reuse more denoising tiles and pass code.
A lot of code is now shared with regular rendering, with the two main
differences being that we read some render result passes from the bake API
when starting to render a tile, and call the bake kernel instead of the
path trace kernel.
With this kind of design where Cycles asks for tiles from the bake API,
it should eventually be easier to reduce memory usage, show tiles as
they are baked, or bake multiple passes at once, though there's still
quite some work needed for that.
Reviewers: #cycles
Subscribers: monio, wmatyjewicz, lukasstockner97, michaelknubben
Differential Revision: https://developer.blender.org/D3108
2019-05-10 21:39:58 +02:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("Denoising Normal", PASS_DENOISING_NORMAL, true);
|
|
|
|
|
MAP_PASS("Denoising Albedo", PASS_DENOISING_ALBEDO, true);
|
|
|
|
|
MAP_PASS("Denoising Depth", PASS_DENOISING_DEPTH, true);
|
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
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("Shadow Catcher", PASS_SHADOW_CATCHER, false);
|
|
|
|
|
MAP_PASS("Noisy Shadow Catcher", PASS_SHADOW_CATCHER, true);
|
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
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER, false);
|
|
|
|
|
MAP_PASS("Debug Sample Count", PASS_SAMPLE_COUNT, false);
|
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
|
|
|
|
2023-04-13 10:27:07 +02:00
|
|
|
MAP_PASS("Guiding Color", PASS_GUIDING_COLOR, false);
|
|
|
|
|
MAP_PASS("Guiding Probability", PASS_GUIDING_PROBABILITY, false);
|
|
|
|
|
MAP_PASS("Guiding Average Roughness", PASS_GUIDING_AVG_ROUGHNESS, false);
|
|
|
|
|
|
2018-10-28 05:37:41 -04:00
|
|
|
if (string_startswith(name, cryptomatte_prefix)) {
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
type = PASS_CRYPTOMATTE;
|
|
|
|
|
mode = PassMode::DENOISED;
|
|
|
|
|
return true;
|
2018-10-28 05:37:41 -04: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
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
#undef MAP_PASS
|
|
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
return false;
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02: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
|
|
|
static Pass *pass_add(Scene *scene,
|
|
|
|
|
PassType type,
|
|
|
|
|
const char *name,
|
|
|
|
|
PassMode mode = PassMode::DENOISED)
|
2017-05-07 14:40:58 +02: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
|
|
|
Pass *pass = scene->create_node<Pass>();
|
2019-04-17 06:17:24 +02: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
|
|
|
pass->set_type(type);
|
|
|
|
|
pass->set_name(ustring(name));
|
|
|
|
|
pass->set_mode(mode);
|
2019-04-17 06:17:24 +02: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
|
|
|
return pass;
|
2017-05-07 14:40:58 +02: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
|
|
|
void BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_view_layer)
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02: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
|
|
|
/* Delete all existing passes. */
|
2024-12-30 02:20:36 +01:00
|
|
|
const vector<Pass *> &scene_passes = scene->passes;
|
|
|
|
|
scene->delete_nodes(set<Pass *>(scene_passes.begin(), scene_passes.end()));
|
2019-04-17 06:17:24 +02: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
|
|
|
/* Always add combined pass. */
|
|
|
|
|
pass_add(scene, PASS_COMBINED, "Combined");
|
|
|
|
|
|
2018-10-28 05:37:41 -04:00
|
|
|
/* Cryptomatte stores two ID/weight pairs per RGBA layer.
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
* User facing parameter is the number of pairs. */
|
2024-12-29 17:32:00 +01:00
|
|
|
const int crypto_depth = divide_up(min(16, b_view_layer.pass_cryptomatte_depth()), 2);
|
2020-11-04 11:17:38 +01:00
|
|
|
scene->film->set_cryptomatte_depth(crypto_depth);
|
|
|
|
|
CryptomatteType cryptomatte_passes = CRYPT_NONE;
|
2020-12-07 07:50:14 +01:00
|
|
|
if (b_view_layer.use_pass_cryptomatte_object()) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_OBJECT);
|
2018-10-28 05:37:41 -04:00
|
|
|
}
|
2020-12-07 07:50:14 +01:00
|
|
|
if (b_view_layer.use_pass_cryptomatte_material()) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_MATERIAL);
|
2018-10-28 05:37:41 -04:00
|
|
|
}
|
2020-12-07 07:50:14 +01:00
|
|
|
if (b_view_layer.use_pass_cryptomatte_asset()) {
|
2020-11-04 11:17:38 +01:00
|
|
|
cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ASSET);
|
2018-10-28 05:37:41 -04:00
|
|
|
}
|
2020-11-04 11:17:38 +01:00
|
|
|
scene->film->set_cryptomatte_passes(cryptomatte_passes);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
unordered_set<string> expected_passes;
|
|
|
|
|
|
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
|
|
|
/* Custom AOV passes. */
|
2021-02-12 11:29:50 +01:00
|
|
|
BL::ViewLayer::aovs_iterator b_aov_iter;
|
|
|
|
|
for (b_view_layer.aovs.begin(b_aov_iter); b_aov_iter != b_view_layer.aovs.end(); ++b_aov_iter) {
|
|
|
|
|
BL::AOV b_aov(*b_aov_iter);
|
|
|
|
|
if (!b_aov.is_valid()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-29 17:32:00 +01:00
|
|
|
const string name = b_aov.name();
|
|
|
|
|
const PassType type = (b_aov.type() == BL::AOV::type_COLOR) ? PASS_AOV_COLOR : PASS_AOV_VALUE;
|
2019-12-04 19:57:28 +01:00
|
|
|
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
pass_add(scene, type, name.c_str());
|
|
|
|
|
expected_passes.insert(name);
|
2019-12-04 19:57:28 +01:00
|
|
|
}
|
|
|
|
|
|
2022-04-02 00:11:11 +02:00
|
|
|
/* Light Group passes. */
|
|
|
|
|
BL::ViewLayer::lightgroups_iterator b_lightgroup_iter;
|
|
|
|
|
for (b_view_layer.lightgroups.begin(b_lightgroup_iter);
|
|
|
|
|
b_lightgroup_iter != b_view_layer.lightgroups.end();
|
|
|
|
|
++b_lightgroup_iter)
|
|
|
|
|
{
|
|
|
|
|
BL::Lightgroup b_lightgroup(*b_lightgroup_iter);
|
|
|
|
|
|
2024-12-29 17:32:00 +01:00
|
|
|
const string name = string_printf("Combined_%s", b_lightgroup.name().c_str());
|
2022-04-02 00:11:11 +02:00
|
|
|
|
|
|
|
|
Pass *pass = pass_add(scene, PASS_COMBINED, name.c_str(), PassMode::NOISY);
|
|
|
|
|
pass->set_lightgroup(ustring(b_lightgroup.name()));
|
Fix T93382: Blender still generates subsurface render passes
In T93382, the problem was that the Blender-side rendering code was
still generating the subsurface passes because the old render pass
flags were set, even though Cycles doesn't generate them anymore.
After a closer look, it turns out that the entire hardcoded pass
creation code can be removed. We already have an Engine API function
to query the list of render passes from the engine, so we might as
well just call that and create the returned passes.
Turns out that Eevee already did this anyways. On the Cycles side, it
allows to deduplicate a lot of `BlenderSync::sync_render_passes`.
Before, passes were defined in engine.py and in sync.cpp. Now, all
passes that engine.py returns are created automatically, so sync.cpp
only needs to handle a few special cases.
I'm not really concerned about affecting external renderer addons,
since they already needed to handle the old "builtin passes" in
their Engine API implementation anyways to make them show up in the
compositor. So, unless they missed that for like 10 releases, they
should not notice any difference.
Differential Revision: https://developer.blender.org/D16295
2022-10-19 04:02:39 +02:00
|
|
|
expected_passes.insert(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sync the passes that were defined in engine.py. */
|
|
|
|
|
for (BL::RenderPass &b_pass : b_rlay.passes) {
|
|
|
|
|
PassType pass_type = PASS_NONE;
|
|
|
|
|
PassMode pass_mode = PassMode::DENOISED;
|
|
|
|
|
|
|
|
|
|
if (!get_known_pass_type(b_pass, pass_type, pass_mode)) {
|
|
|
|
|
if (!expected_passes.count(b_pass.name())) {
|
|
|
|
|
LOG(ERROR) << "Unknown pass " << b_pass.name();
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pass_type == PASS_MOTION &&
|
|
|
|
|
(b_view_layer.use_motion_blur() && b_scene.render().use_motion_blur()))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pass_add(scene, pass_type, b_pass.name().c_str(), pass_mode);
|
2022-04-02 00:11:11 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-04 11:17:38 +01:00
|
|
|
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-18 16:09:19 +02:00
|
|
|
void BlenderSync::free_data_after_sync(BL::Depsgraph &b_depsgraph)
|
|
|
|
|
{
|
|
|
|
|
/* When viewport display is not needed during render we can force some
|
|
|
|
|
* caches to be releases from blender side in order to reduce peak memory
|
|
|
|
|
* footprint during synchronization process.
|
|
|
|
|
*/
|
2021-05-11 17:17:00 +02:00
|
|
|
|
2018-07-18 16:09:19 +02:00
|
|
|
const bool is_interface_locked = b_engine.render() && b_engine.render().use_lock_interface();
|
2021-05-11 17:17:00 +02:00
|
|
|
const bool is_persistent_data = b_engine.render() && b_engine.render().use_persistent_data();
|
|
|
|
|
const bool can_free_caches =
|
|
|
|
|
(BlenderSession::headless || is_interface_locked) &&
|
|
|
|
|
/* Baking re-uses the depsgraph multiple times, clearing crashes
|
|
|
|
|
* reading un-evaluated mesh data which isn't aligned with the
|
2023-02-12 14:37:16 +11:00
|
|
|
* geometry we're baking, see #71012. */
|
2025-01-02 12:48:21 +01:00
|
|
|
!b_bake_target &&
|
2021-05-11 17:17:00 +02:00
|
|
|
/* Persistent data must main caches for performance and correctness. */
|
|
|
|
|
!is_persistent_data;
|
|
|
|
|
|
2018-11-15 17:19:26 +01:00
|
|
|
if (!can_free_caches) {
|
2018-07-18 16:09:19 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* TODO(sergey): We can actually remove the whole dependency graph,
|
|
|
|
|
* but that will need some API support first.
|
|
|
|
|
*/
|
2021-01-25 16:20:10 +01:00
|
|
|
for (BL::Object &b_ob : b_depsgraph.objects) {
|
2024-04-05 18:13:12 +02:00
|
|
|
/* Grease pencil render requires all evaluated objects available as-is after Cycles is done
|
|
|
|
|
* with its part. */
|
2025-02-25 10:46:27 +01:00
|
|
|
if (b_ob.type() == BL::Object::type_GREASEPENCIL) {
|
2024-04-05 18:13:12 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
2021-01-25 16:20:10 +01:00
|
|
|
b_ob.cache_release();
|
2018-07-18 16:09:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Scene Parameters */
|
|
|
|
|
|
2022-08-11 16:59:29 +02:00
|
|
|
SceneParams BlenderSync::get_scene_params(BL::Scene &b_scene,
|
|
|
|
|
const bool background,
|
|
|
|
|
const bool use_developer_ui)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
SceneParams params;
|
|
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
2014-02-03 18:55:59 +11:00
|
|
|
const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (shadingsystem == 0) {
|
2014-05-19 13:49:36 +03:00
|
|
|
params.shadingsystem = SHADINGSYSTEM_SVM;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else if (shadingsystem == 1) {
|
2014-05-19 13:49:36 +03:00
|
|
|
params.shadingsystem = SHADINGSYSTEM_OSL;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (background || (use_developer_ui && get_enum(cscene, "debug_bvh_type"))) {
|
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
|
|
|
params.bvh_type = BVH_TYPE_STATIC;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else {
|
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
|
|
|
params.bvh_type = BVH_TYPE_DYNAMIC;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
|
2022-01-25 17:16:13 +01:00
|
|
|
params.use_bvh_compact_structure = RNA_boolean_get(&cscene, "debug_use_compact_bvh");
|
2016-07-07 18:04:16 +02:00
|
|
|
params.use_bvh_unaligned_nodes = RNA_boolean_get(&cscene, "debug_use_hair_bvh");
|
2017-01-17 15:13:01 +01:00
|
|
|
params.num_bvh_time_steps = RNA_int_get(&cscene, "debug_bvh_time_steps");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-10 19:07:07 +02:00
|
|
|
PointerRNA csscene = RNA_pointer_get(&b_scene.ptr, "cycles_curves");
|
|
|
|
|
params.hair_subdivisions = get_int(csscene, "subdivisions");
|
|
|
|
|
params.hair_shape = (CurveShapeType)get_enum(
|
|
|
|
|
csscene, "shape", CURVE_NUM_SHAPE_TYPES, CURVE_THICK);
|
|
|
|
|
|
2016-11-17 12:13:22 +01:00
|
|
|
int texture_limit;
|
|
|
|
|
if (background) {
|
|
|
|
|
texture_limit = RNA_enum_get(&cscene, "texture_limit_render");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
texture_limit = RNA_enum_get(&cscene, "texture_limit");
|
|
|
|
|
}
|
|
|
|
|
if (texture_limit > 0 && b_scene.render().use_simplify()) {
|
|
|
|
|
params.texture_limit = 1 << (texture_limit + 6);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
params.texture_limit = 0;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-10 18:55:33 +02:00
|
|
|
params.bvh_layout = DebugFlags().cpu.bvh_layout;
|
2014-12-25 00:53:26 +05:00
|
|
|
|
Add support for tiled images and the UDIM naming scheme
This patch contains the work that I did during my week at the Code Quest - adding support for tiled images to Blender.
With this patch, images now contain a list of tiles. By default, this just contains one tile, but if the source type is set to Tiled, the user can add additional tiles. When acquiring an ImBuf, the tile to be loaded is specified in the ImageUser.
Therefore, code that is not yet aware of tiles will just access the default tile as usual.
The filenames of the additional tiles are derived from the original filename according to the UDIM naming scheme - the filename contains an index that is calculated as (1001 + 10*<y coordinate of the tile> + <x coordinate of the tile>), where the x coordinate never goes above 9.
Internally, the various tiles are stored in a cache just like sequences. When acquired for the first time, the code will try to load the corresponding file from disk. Alternatively, a new operator can be used to initialize the tile similar to the New Image operator.
The following features are supported so far:
- Automatic detection and loading of all tiles when opening the first tile (1001)
- Saving all tiles
- Adding and removing tiles
- Filling tiles with generated images
- Drawing all tiles in the Image Editor
- Viewing a tiled grid even if no image is selected
- Rendering tiled images in Eevee
- Rendering tiled images in Cycles (in SVM mode)
- Automatically skipping loading of unused tiles in Cycles
- 2D texture painting (also across tiles)
- 3D texture painting (also across tiles, only limitation: individual faces can not cross tile borders)
- Assigning custom labels to individual tiles (drawn in the Image Editor instead of the ID)
- Different resolutions between tiles
There still are some missing features that will be added later (see T72390):
- Workbench engine support
- Packing/Unpacking support
- Baking support
- Cycles OSL support
- many other Blender features that rely on images
Thanks to Brecht for the review and to all who tested the intermediate versions!
Differential Revision: https://developer.blender.org/D3509
2019-12-12 16:06:08 +01:00
|
|
|
params.background = background;
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
return params;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Session Parameters */
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
bool BlenderSync::get_session_pause(BL::Scene &b_scene, bool background)
|
2011-08-29 16:54:13 +00:00
|
|
|
{
|
|
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
|
|
|
|
return (background) ? false : get_boolean(cscene, "preview_pause");
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-30 14:18:29 +01:00
|
|
|
SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
|
2019-02-11 13:37:45 +01:00
|
|
|
BL::Preferences &b_preferences,
|
2016-01-30 14:18:29 +01:00
|
|
|
BL::Scene &b_scene,
|
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
|
|
|
bool background)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
SessionParams params;
|
|
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-10 16:05:17 +01:00
|
|
|
if (background && !b_engine.is_preview()) {
|
|
|
|
|
/* Viewport and preview renders do not require temp directory and do request session
|
|
|
|
|
* parameters more often than the background render.
|
|
|
|
|
* Optimize RNA-C++ usage and memory allocation a bit by saving string access which we know is
|
|
|
|
|
* not needed for viewport render. */
|
|
|
|
|
params.temp_dir = b_engine.temporary_directory();
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-01 16:33:21 +00:00
|
|
|
/* feature set */
|
2016-02-10 03:25:53 +05:00
|
|
|
params.experimental = (get_enum(cscene, "feature_set") != 0);
|
2019-04-17 06:17:24 +02: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
|
|
|
/* Headless and background rendering. */
|
|
|
|
|
params.headless = BlenderSession::headless;
|
2017-10-21 18:58:59 +02:00
|
|
|
params.background = background;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-06 16:15:45 +01:00
|
|
|
/* Device */
|
|
|
|
|
params.threads = blender_device_threads(b_scene);
|
2023-01-05 19:42:16 +01:00
|
|
|
params.device = blender_device_info(
|
2024-06-03 22:41:25 +02:00
|
|
|
b_preferences, b_scene, params.background, b_engine.is_preview(), params.denoise_device);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-16 13:14:02 +00:00
|
|
|
/* samples */
|
2024-12-29 17:32:00 +01:00
|
|
|
const int samples = get_int(cscene, "samples");
|
|
|
|
|
const int preview_samples = get_int(cscene, "preview_samples");
|
2025-01-15 07:41:16 +01:00
|
|
|
const bool use_sample_subset = get_boolean(cscene, "use_sample_subset");
|
|
|
|
|
const int sample_subset_offset = get_int(cscene, "sample_offset");
|
|
|
|
|
const int sample_subset_length = get_int(cscene, "sample_subset_length");
|
2019-04-17 06:17:24 +02: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
|
|
|
if (background) {
|
|
|
|
|
params.samples = samples;
|
2025-01-15 07:41:16 +01:00
|
|
|
|
|
|
|
|
params.use_sample_subset = use_sample_subset;
|
|
|
|
|
params.sample_subset_offset = sample_subset_offset;
|
|
|
|
|
params.sample_subset_length = sample_subset_length;
|
2011-08-28 13:55:59 +00:00
|
|
|
}
|
|
|
|
|
else {
|
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
|
|
|
params.samples = preview_samples;
|
2021-11-11 08:57:35 +01:00
|
|
|
if (params.samples == 0) {
|
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
|
|
|
params.samples = INT_MAX;
|
2021-11-11 08:57:35 +01:00
|
|
|
}
|
2025-01-15 07:41:16 +01:00
|
|
|
params.use_sample_subset = false;
|
|
|
|
|
params.sample_subset_offset = 0;
|
|
|
|
|
params.sample_subset_length = 0;
|
2011-08-28 13:55:59 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-31 23:49:10 +02:00
|
|
|
/* Viewport Performance */
|
2017-08-15 00:11:52 +02:00
|
|
|
params.pixel_size = b_engine.get_preview_pixel_size(b_scene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
if (background) {
|
2017-08-15 00:11:52 +02:00
|
|
|
params.pixel_size = 1;
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-26 09:25:02 +00:00
|
|
|
/* shading system - scene level needs full refresh */
|
2014-02-03 18:55:59 +11:00
|
|
|
const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-17 09:01:48 +10:00
|
|
|
if (shadingsystem == 0) {
|
2014-05-19 13:49:36 +03:00
|
|
|
params.shadingsystem = SHADINGSYSTEM_SVM;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
|
|
|
|
else if (shadingsystem == 1) {
|
2014-05-19 13:49:36 +03:00
|
|
|
params.shadingsystem = SHADINGSYSTEM_OSL;
|
2023-09-17 09:01:48 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02: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
|
|
|
/* Time limit. */
|
|
|
|
|
if (background) {
|
2021-11-17 17:22:05 +01:00
|
|
|
params.time_limit = (double)get_float(cscene, "time_limit");
|
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
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* For the viewport it kind of makes more sense to think in terms of the noise floor, which is
|
|
|
|
|
* usually higher than acceptable level for the final frame. */
|
|
|
|
|
/* TODO: It might be useful to support time limit in the viewport as well, but needs some
|
|
|
|
|
* extra thoughts and input. */
|
|
|
|
|
params.time_limit = 0.0;
|
2015-02-21 17:29:27 +05:00
|
|
|
}
|
2019-04-17 06:17:24 +02: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
|
|
|
/* Profiling. */
|
2018-11-29 02:06:30 +01:00
|
|
|
params.use_profiling = params.device.has_profiling && !b_engine.is_preview() && background &&
|
|
|
|
|
BlenderSession::print_render_stats;
|
2019-04-17 06:17:24 +02: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
|
|
|
if (background) {
|
|
|
|
|
params.use_auto_tile = RNA_boolean_get(&cscene, "use_auto_tile");
|
2021-09-22 18:11:15 +02:00
|
|
|
params.tile_size = max(get_int(cscene, "tile_size"), 8);
|
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
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
params.use_auto_tile = false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
return params;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-31 23:49:10 +02:00
|
|
|
DenoiseParams BlenderSync::get_denoise_params(BL::Scene &b_scene,
|
|
|
|
|
BL::ViewLayer &b_view_layer,
|
2024-03-08 16:26:52 +01:00
|
|
|
bool background,
|
2024-06-24 11:28:02 +02:00
|
|
|
const DeviceInfo &denoise_device_info)
|
2020-05-31 23:49:10 +02: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
|
|
|
enum DenoiserInput {
|
|
|
|
|
DENOISER_INPUT_RGB = 1,
|
|
|
|
|
DENOISER_INPUT_RGB_ALBEDO = 2,
|
|
|
|
|
DENOISER_INPUT_RGB_ALBEDO_NORMAL = 3,
|
|
|
|
|
|
|
|
|
|
DENOISER_INPUT_NUM,
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-31 23:49:10 +02:00
|
|
|
DenoiseParams denoising;
|
|
|
|
|
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
|
|
|
|
|
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
|
|
|
int input_passes = -1;
|
|
|
|
|
|
2020-05-31 23:49:10 +02:00
|
|
|
if (background) {
|
|
|
|
|
/* Final Render Denoising */
|
|
|
|
|
denoising.use = get_boolean(cscene, "use_denoising");
|
|
|
|
|
denoising.type = (DenoiserType)get_enum(cscene, "denoiser", DENOISER_NUM, DENOISER_NONE);
|
2024-02-06 17:46:21 +01:00
|
|
|
denoising.use_gpu = get_boolean(cscene, "denoising_use_gpu");
|
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
|
|
|
denoising.prefilter = (DenoiserPrefilter)get_enum(
|
|
|
|
|
cscene, "denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_NONE);
|
2024-05-06 18:56:16 +02:00
|
|
|
denoising.quality = (DenoiserQuality)get_enum(
|
|
|
|
|
cscene, "denoising_quality", DENOISER_QUALITY_NUM, DENOISER_QUALITY_HIGH);
|
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
|
|
|
|
|
|
|
|
input_passes = (DenoiserInput)get_enum(
|
|
|
|
|
cscene, "denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO_NORMAL);
|
2020-05-31 23:49:10 +02:00
|
|
|
|
|
|
|
|
if (b_view_layer) {
|
|
|
|
|
PointerRNA clayer = RNA_pointer_get(&b_view_layer.ptr, "cycles");
|
|
|
|
|
if (!get_boolean(clayer, "use_denoising")) {
|
|
|
|
|
denoising.use = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Viewport Denoising */
|
|
|
|
|
denoising.use = get_boolean(cscene, "use_preview_denoising");
|
|
|
|
|
denoising.type = (DenoiserType)get_enum(
|
|
|
|
|
cscene, "preview_denoiser", DENOISER_NUM, DENOISER_NONE);
|
2024-02-06 17:46:21 +01:00
|
|
|
denoising.use_gpu = get_boolean(cscene, "preview_denoising_use_gpu");
|
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
|
|
|
denoising.prefilter = (DenoiserPrefilter)get_enum(
|
|
|
|
|
cscene, "preview_denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_FAST);
|
2024-05-06 18:56:16 +02:00
|
|
|
denoising.quality = (DenoiserQuality)get_enum(
|
|
|
|
|
cscene, "preview_denoising_quality", DENOISER_QUALITY_NUM, DENOISER_QUALITY_BALANCED);
|
2020-05-31 23:49:10 +02:00
|
|
|
denoising.start_sample = get_int(cscene, "preview_denoising_start_sample");
|
|
|
|
|
|
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
|
|
|
input_passes = (DenoiserInput)get_enum(
|
|
|
|
|
cscene, "preview_denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO);
|
2021-02-22 18:09:48 +01:00
|
|
|
|
2020-05-31 23:49:10 +02:00
|
|
|
/* Auto select fastest denoiser. */
|
|
|
|
|
if (denoising.type == DENOISER_NONE) {
|
2024-06-24 11:28:02 +02:00
|
|
|
denoising.type = Denoiser::automatic_viewport_denoiser_type(denoise_device_info);
|
2024-03-08 16:26:52 +01:00
|
|
|
if (denoising.type == DENOISER_NONE) {
|
2020-05-31 23:49:10 +02:00
|
|
|
denoising.use = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
switch (input_passes) {
|
|
|
|
|
case DENOISER_INPUT_RGB:
|
|
|
|
|
denoising.use_pass_albedo = false;
|
|
|
|
|
denoising.use_pass_normal = false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DENOISER_INPUT_RGB_ALBEDO:
|
|
|
|
|
denoising.use_pass_albedo = true;
|
|
|
|
|
denoising.use_pass_normal = false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DENOISER_INPUT_RGB_ALBEDO_NORMAL:
|
|
|
|
|
denoising.use_pass_albedo = true;
|
|
|
|
|
denoising.use_pass_normal = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
LOG(ERROR) << "Unhandled input passes enum " << input_passes;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-31 23:49:10 +02:00
|
|
|
return denoising;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|