Blender V4.5
sync.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "RNA_types.hh"
6#include "scene/background.h"
7#include "scene/bake.h"
8#include "scene/camera.h"
9#include "scene/curves.h"
10#include "scene/film.h"
11#include "scene/integrator.h"
12#include "scene/light.h"
13#include "scene/mesh.h"
14#include "scene/object.h"
15#include "scene/procedural.h"
16#include "scene/scene.h"
17#include "scene/shader.h"
18#include "scene/shader_graph.h"
19#include "scene/shader_nodes.h"
20
21#include "device/device.h"
22
23#include "blender/device.h"
24#include "blender/session.h"
25#include "blender/sync.h"
26#include "blender/util.h"
27
28#include "integrator/denoiser.h"
29
30#include "util/debug.h"
31
32#include "util/hash.h"
33#include "util/log.h"
34
36
37static const char *cryptomatte_prefix = "Crypto";
38
39/* Constructor */
40
41BlenderSync::BlenderSync(BL::RenderEngine &b_engine,
42 BL::BlendData &b_data,
43 BL::Scene &b_scene,
44 Scene *scene,
45 bool preview,
46 bool use_developer_ui,
47 Progress &progress)
48 : b_engine(b_engine),
49 b_data(b_data),
50 b_scene(b_scene),
51 b_bake_target(PointerRNA_NULL),
52 shader_map(scene),
53 object_map(scene),
54 procedural_map(scene),
55 geometry_map(scene),
56 particle_system_map(scene),
57 world_map(nullptr),
58 world_recalc(false),
59 scene(scene),
60 preview(preview),
61 use_developer_ui(use_developer_ui),
62 dicing_rate(1.0f),
63 max_subdivisions(12),
64 progress(progress)
65
66{
67 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
68 dicing_rate = preview ? RNA_float_get(&cscene, "preview_dicing_rate") :
69 RNA_float_get(&cscene, "dicing_rate");
70 max_subdivisions = RNA_int_get(&cscene, "max_subdivisions");
71}
72
74
75void BlenderSync::reset(BL::BlendData &b_data, BL::Scene &b_scene)
76{
77 /* Update data and scene pointers in case they change in session reset,
78 * for example after undo.
79 * Note that we do not modify the `has_updates_` flag here because the sync
80 * reset is also used during viewport navigation. */
81 this->b_data = b_data;
82 this->b_scene = b_scene;
83}
84
86{
87 has_updates_ = true;
88}
89
90void BlenderSync::set_bake_target(BL::Object &b_object)
91{
92 b_bake_target = b_object;
93}
94
95/* Sync */
96
97void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph,
98 BL::SpaceView3D &b_v3d,
99 BL::RegionView3D &b_rv3d)
100{
101 /* Sync recalc flags from blender to cycles. Actual update is done separate,
102 * so we can do it later on if doing it immediate is not suitable. */
103 BL::Object b_dicing_camera_object = get_dicing_camera_object(b_v3d, b_rv3d);
104 bool dicing_camera_updated = false;
105
106 /* Iterate over all IDs in this depsgraph. */
107 for (BL::DepsgraphUpdate &b_update : b_depsgraph.updates) {
108 /* TODO(sergey): Can do more selective filter here. For example, ignore changes made to
109 * screen data-block. Note that sync_data() needs to be called after object deletion, and
110 * currently this is ensured by the scene ID tagged for update, which sets the `has_updates_`
111 * flag. */
112 has_updates_ = true;
113
114 BL::ID b_id(b_update.id());
115
116 /* Material */
117 if (b_id.is_a(&RNA_Material)) {
118 const BL::Material b_mat(b_id);
119 shader_map.set_recalc(b_mat);
120 }
121 /* Light */
122 else if (b_id.is_a(&RNA_Light)) {
123 const BL::Light b_light(b_id);
124 shader_map.set_recalc(b_light);
125 geometry_map.set_recalc(b_light);
126 }
127 /* Object */
128 else if (b_id.is_a(&RNA_Object)) {
129 BL::Object b_ob(b_id);
130 const bool can_have_geometry = object_can_have_geometry(b_ob);
131 const bool is_light = !can_have_geometry && object_is_light(b_ob);
132
133 if (b_ob.is_instancer() && b_update.is_updated_shading()) {
134 /* Needed for object color updates on instancer, among other things. */
135 object_map.set_recalc(b_ob);
136 }
137
138 if (can_have_geometry || is_light) {
139 const bool updated_geometry = b_update.is_updated_geometry();
140 const bool updated_transform = b_update.is_updated_transform();
141
142 /* Geometry (mesh, hair, volume). */
143 if (can_have_geometry) {
144 if (updated_transform || b_update.is_updated_shading()) {
145 object_map.set_recalc(b_ob);
146 }
147
148 const bool use_adaptive_subdiv = object_subdivision_type(
149 b_ob, preview, use_adaptive_subdivision) !=
151
152 /* Need to recompute geometry if the geometry changed, or the transform changed
153 * and using adaptive subdivision. */
154 if (updated_geometry || (updated_transform && use_adaptive_subdiv)) {
155 BL::ID const key = BKE_object_is_modified(b_ob) ?
156 b_ob :
157 object_get_data(b_ob, use_adaptive_subdiv);
158 geometry_map.set_recalc(key);
159
160 /* Sync all contained geometry instances as well when the object changed.. */
161 const map<void *, set<BL::ID>>::const_iterator instance_geometries =
162 instance_geometries_by_object.find(b_ob.ptr.data);
163 if (instance_geometries != instance_geometries_by_object.end()) {
164 for (BL::ID const &geometry : instance_geometries->second) {
165 geometry_map.set_recalc(geometry);
166 }
167 }
168 }
169
170 if (updated_geometry) {
171 BL::Object::particle_systems_iterator b_psys;
172 for (b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end();
173 ++b_psys)
174 {
175 particle_system_map.set_recalc(b_ob);
176 }
177 }
178 }
179 /* Light */
180 else if (is_light) {
181 if (b_update.is_updated_transform() || b_update.is_updated_shading()) {
182 object_map.set_recalc(b_ob);
183 geometry_map.set_recalc(b_ob);
184 }
185
186 if (updated_geometry) {
187 geometry_map.set_recalc(b_ob);
188 }
189 }
190 }
191 else if (object_is_camera(b_ob)) {
192 shader_map.set_recalc(b_ob);
193 }
194
195 if (b_dicing_camera_object == b_ob) {
196 dicing_camera_updated = true;
197 }
198 }
199 /* Mesh */
200 else if (b_id.is_a(&RNA_Mesh)) {
201 const BL::Mesh b_mesh(b_id);
202 geometry_map.set_recalc(b_mesh);
203 }
204 /* World */
205 else if (b_id.is_a(&RNA_World)) {
206 const BL::World b_world(b_id);
207 if (world_map == b_world.ptr.data) {
208 world_recalc = true;
209 }
210 shader_map.set_recalc(b_world);
211 }
212 /* World */
213 else if (b_id.is_a(&RNA_Scene)) {
214 shader_map.set_recalc(b_id);
215 }
216 /* Volume */
217 else if (b_id.is_a(&RNA_Volume)) {
218 const BL::Volume b_volume(b_id);
219 geometry_map.set_recalc(b_volume);
220 }
221 /* Camera */
222 else if (b_id.is_a(&RNA_Camera)) {
223 if (b_dicing_camera_object && b_dicing_camera_object.data() == b_id) {
224 dicing_camera_updated = true;
225 }
226 }
227 }
228
229 if (use_adaptive_subdivision) {
230 /* Mark all meshes as needing to be exported again if dicing changed. */
231 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
232 bool dicing_prop_changed = false;
233
234 const float updated_dicing_rate = preview ? RNA_float_get(&cscene, "preview_dicing_rate") :
235 RNA_float_get(&cscene, "dicing_rate");
236
237 if (dicing_rate != updated_dicing_rate) {
238 dicing_rate = updated_dicing_rate;
239 dicing_prop_changed = true;
240 }
241
242 const int updated_max_subdivisions = RNA_int_get(&cscene, "max_subdivisions");
243
244 if (max_subdivisions != updated_max_subdivisions) {
245 max_subdivisions = updated_max_subdivisions;
246 dicing_prop_changed = true;
247 }
248
249 if ((dicing_camera_updated && !region_view3d_navigating_or_transforming(b_rv3d)) ||
250 dicing_prop_changed)
251 {
252 has_updates_ = true;
253
254 for (const pair<const GeometryKey, Geometry *> &iter : geometry_map.key_to_scene_data()) {
255 Geometry *geom = iter.second;
256 if (geom->is_mesh()) {
257 Mesh *mesh = static_cast<Mesh *>(geom);
258 if (mesh->get_subdivision_type() != Mesh::SUBDIVISION_NONE) {
259 const PointerRNA id_ptr = RNA_id_pointer_create((::ID *)iter.first.id);
260 geometry_map.set_recalc(BL::ID(id_ptr));
261 }
262 }
263 }
264 }
265 }
266
267 if (b_v3d) {
268 const BlenderViewportParameters new_viewport_parameters(b_v3d, use_developer_ui);
269
270 if (viewport_parameters.shader_modified(new_viewport_parameters)) {
271 world_recalc = true;
272 has_updates_ = true;
273 }
274
275 has_updates_ |= viewport_parameters.modified(new_viewport_parameters);
276 }
277}
278
279void BlenderSync::sync_data(BL::RenderSettings &b_render,
280 BL::Depsgraph &b_depsgraph,
281 BL::SpaceView3D &b_v3d,
282 BL::Object &b_override,
283 const int width,
284 const int height,
285 void **python_thread_state,
286 const DeviceInfo &denoise_device_info)
287{
288 /* For auto refresh images. */
289 ImageManager *image_manager = scene->image_manager.get();
290 const int frame = b_scene.frame_current();
291 const bool auto_refresh_update = image_manager->set_animation_frame_update(frame);
292
293 if (!has_updates_ && !auto_refresh_update) {
294 return;
295 }
296
297 const scoped_timer timer;
298
299 BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
300
301 /* TODO(sergey): This feels weak to pass view layer to the integrator, and even weaker to have an
302 * implicit check on whether it is a background render or not. What is the nicer thing here? */
303 const bool background = !b_v3d;
304
305 sync_view_layer(b_view_layer);
306 sync_integrator(b_view_layer, background, denoise_device_info);
307 sync_film(b_view_layer, b_v3d);
308 sync_shaders(b_depsgraph, b_v3d, auto_refresh_update);
309 sync_images();
310
311 geometry_synced.clear(); /* use for objects and motion sync */
312
313 if (scene->need_motion() == Scene::MOTION_PASS || scene->need_motion() == Scene::MOTION_NONE ||
314 scene->camera->get_motion_position() == MOTION_POSITION_CENTER)
315 {
316 sync_objects(b_depsgraph, b_v3d);
317 }
318 sync_motion(b_render, b_depsgraph, b_v3d, b_override, width, height, python_thread_state);
319
320 geometry_synced.clear();
321
322 /* Shader sync done at the end, since object sync uses it.
323 * false = don't delete unused shaders, not supported. */
324 shader_map.post_sync(false);
325
326 VLOG_INFO << "Total time spent synchronizing data: " << timer.get_time();
327
328 has_updates_ = false;
329}
330
331/* Integrator */
332
333void BlenderSync::sync_integrator(BL::ViewLayer &b_view_layer,
334 bool background,
335 const DeviceInfo &denoise_device_info)
336{
337 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
338
339 /* No adaptive subdivision for baking, mesh needs to match Blender exactly. */
340 use_adaptive_subdivision = (get_enum(cscene, "feature_set") != 0) && !b_bake_target;
341 use_experimental_procedural = (get_enum(cscene, "feature_set") != 0);
342
343 Integrator *integrator = scene->integrator;
344
345 integrator->set_min_bounce(get_int(cscene, "min_light_bounces"));
346 integrator->set_max_bounce(get_int(cscene, "max_bounces"));
347
348 integrator->set_max_diffuse_bounce(get_int(cscene, "diffuse_bounces"));
349 integrator->set_max_glossy_bounce(get_int(cscene, "glossy_bounces"));
350 integrator->set_max_transmission_bounce(get_int(cscene, "transmission_bounces"));
351 integrator->set_max_volume_bounce(get_int(cscene, "volume_bounces"));
352
353 integrator->set_transparent_min_bounce(get_int(cscene, "min_transparent_bounces"));
354 integrator->set_transparent_max_bounce(get_int(cscene, "transparent_max_bounces"));
355
356 integrator->set_volume_max_steps(get_int(cscene, "volume_max_steps"));
357 const float volume_step_rate = (preview) ? get_float(cscene, "volume_preview_step_rate") :
358 get_float(cscene, "volume_step_rate");
359 integrator->set_volume_step_rate(volume_step_rate);
360
361 integrator->set_caustics_reflective(get_boolean(cscene, "caustics_reflective"));
362 integrator->set_caustics_refractive(get_boolean(cscene, "caustics_refractive"));
363 integrator->set_filter_glossy(get_float(cscene, "blur_glossy"));
364
365 int seed = get_int(cscene, "seed");
366 if (get_boolean(cscene, "use_animated_seed")) {
367 seed = hash_uint2(b_scene.frame_current(), get_int(cscene, "seed"));
368 if (b_scene.frame_subframe() != 0.0f) {
369 /* TODO(sergey): Ideally should be some sort of hash_merge,
370 * but this is good enough for now.
371 */
372 seed += hash_uint2((int)(b_scene.frame_subframe() * (float)INT_MAX),
373 get_int(cscene, "seed"));
374 }
375 }
376
377 integrator->set_seed(seed);
378
379 integrator->set_sample_clamp_direct(get_float(cscene, "sample_clamp_direct"));
380 integrator->set_sample_clamp_indirect(get_float(cscene, "sample_clamp_indirect"));
381 if (!preview) {
382 integrator->set_motion_blur(view_layer.use_motion_blur);
383 }
384
385 const bool use_light_tree = get_boolean(cscene, "use_light_tree");
386 integrator->set_use_light_tree(use_light_tree);
387 integrator->set_light_sampling_threshold(get_float(cscene, "light_sampling_threshold"));
388
389 if (integrator->use_light_tree_is_modified()) {
390 scene->light_manager->tag_update(scene, LightManager::UPDATE_ALL);
391 }
392
393 SamplingPattern sampling_pattern = (SamplingPattern)get_enum(
394 cscene, "sampling_pattern", SAMPLING_NUM_PATTERNS, SAMPLING_PATTERN_TABULATED_SOBOL);
395
396 switch (sampling_pattern) {
398 if (!background) {
399 /* For interactive rendering, ensure that the first sample is in itself
400 * blue-noise-distributed for smooth viewport navigation. */
401 sampling_pattern = SAMPLING_PATTERN_BLUE_NOISE_FIRST;
402 }
403 else {
404 /* For non-interactive rendering, default to a full blue-noise pattern. */
405 sampling_pattern = SAMPLING_PATTERN_BLUE_NOISE_PURE;
406 }
407 break;
410 /* Always allowed. */
411 break;
412 default:
413 /* If not using developer UI, default to blue noise for "advanced" patterns. */
414 if (!use_developer_ui) {
415 sampling_pattern = SAMPLING_PATTERN_BLUE_NOISE_PURE;
416 }
417 break;
418 }
419
420 const bool is_vertex_baking = b_bake_target && b_scene.render().bake().target() !=
421 BL::BakeSettings::target_IMAGE_TEXTURES;
422 scene->bake_manager->set_use_seed(is_vertex_baking);
423 if (is_vertex_baking) {
424 /* When baking vertex colors, the "pixels" in the output are unrelated to their neighbors,
425 * so blue-noise sampling makes no sense. */
426 sampling_pattern = SAMPLING_PATTERN_TABULATED_SOBOL;
427 }
428
429 integrator->set_sampling_pattern(sampling_pattern);
430
431 int samples = 1;
432 bool use_adaptive_sampling = false;
433 if (preview) {
434 samples = get_int(cscene, "preview_samples");
435 use_adaptive_sampling = RNA_boolean_get(&cscene, "use_preview_adaptive_sampling");
436 integrator->set_use_adaptive_sampling(use_adaptive_sampling);
437 integrator->set_adaptive_threshold(get_float(cscene, "preview_adaptive_threshold"));
438 integrator->set_adaptive_min_samples(get_int(cscene, "preview_adaptive_min_samples"));
439 }
440 else {
441 samples = get_int(cscene, "samples");
442 use_adaptive_sampling = RNA_boolean_get(&cscene, "use_adaptive_sampling");
443 integrator->set_use_adaptive_sampling(use_adaptive_sampling);
444 integrator->set_adaptive_threshold(get_float(cscene, "adaptive_threshold"));
445 integrator->set_adaptive_min_samples(get_int(cscene, "adaptive_min_samples"));
446 }
447
448 float scrambling_distance = get_float(cscene, "scrambling_distance");
449 const bool auto_scrambling_distance = get_boolean(cscene, "auto_scrambling_distance");
450 if (auto_scrambling_distance) {
451 if (samples == 0) {
452 /* If samples is 0, then viewport rendering is set to render infinitely. In that case we
453 * override the samples value with 4096 so the Automatic Scrambling Distance algorithm
454 * picks a Scrambling Distance value with a good balance of performance and correlation
455 * artifacts when rendering to high sample counts. */
456 samples = 4096;
457 }
458
459 if (use_adaptive_sampling) {
460 /* If Adaptive Sampling is enabled, use "min_samples" in the Automatic Scrambling Distance
461 * algorithm to avoid artifacts common with Adaptive Sampling + Scrambling Distance. */
462 const AdaptiveSampling adaptive_sampling = integrator->get_adaptive_sampling();
463 samples = min(samples, adaptive_sampling.min_samples);
464 }
465 scrambling_distance *= 4.0f / sqrtf(samples);
466 }
467
468 /* Only use scrambling distance in the viewport if user wants to. */
469 const bool preview_scrambling_distance = get_boolean(cscene, "preview_scrambling_distance");
470 if ((preview && !preview_scrambling_distance) ||
471 sampling_pattern != SAMPLING_PATTERN_TABULATED_SOBOL)
472 {
473 scrambling_distance = 1.0f;
474 }
475
476 if (scrambling_distance != 1.0f) {
477 VLOG_INFO << "Using scrambling distance: " << scrambling_distance;
478 }
479 integrator->set_scrambling_distance(scrambling_distance);
480
481 if (get_boolean(cscene, "use_fast_gi")) {
482 if (preview) {
483 integrator->set_ao_bounces(get_int(cscene, "ao_bounces"));
484 }
485 else {
486 integrator->set_ao_bounces(get_int(cscene, "ao_bounces_render"));
487 }
488 }
489 else {
490 integrator->set_ao_bounces(0);
491 }
492
493#ifdef WITH_CYCLES_DEBUG
494 DirectLightSamplingType direct_light_sampling_type = (DirectLightSamplingType)get_enum(
495 cscene, "direct_light_sampling_type", DIRECT_LIGHT_SAMPLING_NUM, DIRECT_LIGHT_SAMPLING_MIS);
496 integrator->set_direct_light_sampling_type(direct_light_sampling_type);
497#endif
498
499 integrator->set_use_guiding(get_boolean(cscene, "use_guiding"));
500 integrator->set_use_surface_guiding(get_boolean(cscene, "use_surface_guiding"));
501 integrator->set_use_volume_guiding(get_boolean(cscene, "use_volume_guiding"));
502 integrator->set_guiding_training_samples(get_int(cscene, "guiding_training_samples"));
503
504 if (use_developer_ui) {
505 integrator->set_deterministic_guiding(get_boolean(cscene, "use_deterministic_guiding"));
506 integrator->set_surface_guiding_probability(get_float(cscene, "surface_guiding_probability"));
507 integrator->set_volume_guiding_probability(get_float(cscene, "volume_guiding_probability"));
508 integrator->set_use_guiding_direct_light(get_boolean(cscene, "use_guiding_direct_light"));
509 integrator->set_use_guiding_mis_weights(get_boolean(cscene, "use_guiding_mis_weights"));
510 const GuidingDistributionType guiding_distribution_type = (GuidingDistributionType)get_enum(
511 cscene, "guiding_distribution_type", GUIDING_NUM_TYPES, GUIDING_TYPE_PARALLAX_AWARE_VMM);
512 integrator->set_guiding_distribution_type(guiding_distribution_type);
513 const GuidingDirectionalSamplingType guiding_directional_sampling_type =
515 "guiding_directional_sampling_type",
518 integrator->set_guiding_directional_sampling_type(guiding_directional_sampling_type);
519 integrator->set_guiding_roughness_threshold(get_float(cscene, "guiding_roughness_threshold"));
520 }
521
522 DenoiseParams denoise_params = get_denoise_params(
523 b_scene, b_view_layer, background, denoise_device_info);
524
525 /* No denoising support for vertex color baking, vertices packed into image
526 * buffer have no relation to neighbors. */
527 if (is_vertex_baking) {
528 denoise_params.use = false;
529 }
530
531 integrator->set_use_denoise(denoise_params.use);
532
533 /* Only update denoiser parameters if the denoiser is actually used. This allows to tweak
534 * denoiser parameters before enabling it without render resetting on every change. The downside
535 * is that the interface and the integrator are technically out of sync. */
536 if (denoise_params.use) {
537 integrator->set_denoiser_type(denoise_params.type);
538 integrator->set_denoise_use_gpu(denoise_params.use_gpu);
539 integrator->set_denoise_start_sample(denoise_params.start_sample);
540 integrator->set_use_denoise_pass_albedo(denoise_params.use_pass_albedo);
541 integrator->set_use_denoise_pass_normal(denoise_params.use_pass_normal);
542 integrator->set_denoiser_prefilter(denoise_params.prefilter);
543 integrator->set_denoiser_quality(denoise_params.quality);
544 }
545
546 /* UPDATE_NONE as we don't want to tag the integrator as modified (this was done by the
547 * set calls above), but we need to make sure that the dependent things are tagged. */
548 integrator->tag_update(scene, Integrator::UPDATE_NONE);
549}
550
551/* Film */
552
553void BlenderSync::sync_film(BL::ViewLayer &b_view_layer, BL::SpaceView3D &b_v3d)
554{
555 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
556 PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
557
558 Film *film = scene->film;
559
560 if (b_v3d) {
561 const BlenderViewportParameters new_viewport_parameters(b_v3d, use_developer_ui);
562 film->set_display_pass(new_viewport_parameters.display_pass);
563 film->set_show_active_pixels(new_viewport_parameters.show_active_pixels);
564 }
565
566 film->set_exposure(get_float(cscene, "film_exposure"));
567 film->set_filter_type(
568 (FilterType)get_enum(cscene, "pixel_filter_type", FILTER_NUM_TYPES, FILTER_BLACKMAN_HARRIS));
569 const float filter_width = (film->get_filter_type() == FILTER_BOX) ?
570 1.0f :
571 get_float(cscene, "filter_width");
572 film->set_filter_width(filter_width);
573
574 if (b_scene.world()) {
575 BL::WorldMistSettings b_mist = b_scene.world().mist_settings();
576
577 film->set_mist_start(b_mist.start());
578 film->set_mist_depth(b_mist.depth());
579
580 switch (b_mist.falloff()) {
581 case BL::WorldMistSettings::falloff_QUADRATIC:
582 film->set_mist_falloff(2.0f);
583 break;
584 case BL::WorldMistSettings::falloff_LINEAR:
585 film->set_mist_falloff(1.0f);
586 break;
587 case BL::WorldMistSettings::falloff_INVERSE_QUADRATIC:
588 film->set_mist_falloff(0.5f);
589 break;
590 }
591 }
592
593 /* Blender viewport does not support proper shadow catcher compositing, so force an approximate
594 * mode to improve visual feedback. */
595 if (b_v3d) {
596 film->set_use_approximate_shadow_catcher(true);
597 }
598 else {
599 film->set_use_approximate_shadow_catcher(!get_boolean(crl, "use_pass_shadow_catcher"));
600 }
601}
602
603/* Render Layer */
604
605void BlenderSync::sync_view_layer(BL::ViewLayer &b_view_layer)
606{
607 view_layer.name = b_view_layer.name();
608
609 /* Filter. */
610 view_layer.use_background_shader = b_view_layer.use_sky();
611 /* Always enable surfaces for baking, otherwise there is nothing to bake to. */
612 view_layer.use_surfaces = b_view_layer.use_solid() || b_bake_target;
613 view_layer.use_hair = b_view_layer.use_strand();
614 view_layer.use_volumes = b_view_layer.use_volumes();
615 view_layer.use_motion_blur = b_view_layer.use_motion_blur() &&
616 b_scene.render().use_motion_blur();
617
618 /* Material override. */
619 view_layer.material_override = b_view_layer.material_override();
620 /* World override. */
621 view_layer.world_override = b_view_layer.world_override();
622
623 /* Sample override. */
624 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
625 const int use_layer_samples = get_enum(cscene, "use_layer_samples");
626
627 view_layer.bound_samples = (use_layer_samples == 1);
628 view_layer.samples = 0;
629
630 if (use_layer_samples != 2) {
631 const int samples = b_view_layer.samples();
632 view_layer.samples = samples;
633 }
634}
635
636/* Images */
637void BlenderSync::sync_images()
638{
639 /* Sync is a convention for this API, but currently it frees unused buffers. */
640
641 const bool is_interface_locked = b_engine.render() && b_engine.render().use_lock_interface();
642 if (is_interface_locked == false && BlenderSession::headless == false) {
643 /* If interface is not locked, it's possible image is needed for
644 * the display.
645 */
646 return;
647 }
648 /* Free buffers used by images which are not needed for render. */
649 for (BL::Image &b_image : b_data.images) {
650 const bool is_builtin = image_is_builtin(b_image, b_engine);
651 if (is_builtin == false) {
652 b_image.buffers_free();
653 }
654 /* TODO(sergey): Free builtin images not used by any shader. */
655 }
656}
657
658/* Passes */
659
660static bool get_known_pass_type(BL::RenderPass &b_pass, PassType &type, PassMode &mode)
661{
662 const string name = b_pass.name();
663#define MAP_PASS(passname, passtype, noisy) \
664 if (name == passname) { \
665 type = passtype; \
666 mode = (noisy) ? PassMode::NOISY : PassMode::DENOISED; \
667 return true; \
668 } \
669 ((void)0)
670
671 /* NOTE: Keep in sync with defined names from engine.py */
672
673 MAP_PASS("Combined", PASS_COMBINED, false);
674 MAP_PASS("Noisy Image", PASS_COMBINED, true);
675
676 MAP_PASS("Depth", PASS_DEPTH, false);
677 MAP_PASS("Mist", PASS_MIST, false);
678 MAP_PASS("Position", PASS_POSITION, false);
679 MAP_PASS("Normal", PASS_NORMAL, false);
680 MAP_PASS("IndexOB", PASS_OBJECT_ID, false);
681 MAP_PASS("UV", PASS_UV, false);
682 MAP_PASS("Vector", PASS_MOTION, false);
683 MAP_PASS("IndexMA", PASS_MATERIAL_ID, false);
684
685 MAP_PASS("DiffDir", PASS_DIFFUSE_DIRECT, false);
686 MAP_PASS("GlossDir", PASS_GLOSSY_DIRECT, false);
687 MAP_PASS("TransDir", PASS_TRANSMISSION_DIRECT, false);
688 MAP_PASS("VolumeDir", PASS_VOLUME_DIRECT, false);
689
690 MAP_PASS("DiffInd", PASS_DIFFUSE_INDIRECT, false);
691 MAP_PASS("GlossInd", PASS_GLOSSY_INDIRECT, false);
692 MAP_PASS("TransInd", PASS_TRANSMISSION_INDIRECT, false);
693 MAP_PASS("VolumeInd", PASS_VOLUME_INDIRECT, false);
694
695 MAP_PASS("DiffCol", PASS_DIFFUSE_COLOR, false);
696 MAP_PASS("GlossCol", PASS_GLOSSY_COLOR, false);
697 MAP_PASS("TransCol", PASS_TRANSMISSION_COLOR, false);
698
699 MAP_PASS("Emit", PASS_EMISSION, false);
700 MAP_PASS("Env", PASS_BACKGROUND, false);
701 MAP_PASS("AO", PASS_AO, false);
702
703 MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE, false);
704 MAP_PASS("BakeSeed", PASS_BAKE_SEED, false);
705 MAP_PASS("BakeDifferential", PASS_BAKE_DIFFERENTIAL, false);
706
707 MAP_PASS("Denoising Normal", PASS_DENOISING_NORMAL, true);
708 MAP_PASS("Denoising Albedo", PASS_DENOISING_ALBEDO, true);
709 MAP_PASS("Denoising Depth", PASS_DENOISING_DEPTH, true);
710
711 MAP_PASS("Shadow Catcher", PASS_SHADOW_CATCHER, false);
712 MAP_PASS("Noisy Shadow Catcher", PASS_SHADOW_CATCHER, true);
713
714 MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER, false);
715 MAP_PASS("Debug Sample Count", PASS_SAMPLE_COUNT, false);
716
717 MAP_PASS("Guiding Color", PASS_GUIDING_COLOR, false);
718 MAP_PASS("Guiding Probability", PASS_GUIDING_PROBABILITY, false);
719 MAP_PASS("Guiding Average Roughness", PASS_GUIDING_AVG_ROUGHNESS, false);
720
722 type = PASS_CRYPTOMATTE;
723 mode = PassMode::DENOISED;
724 return true;
725 }
726
727#undef MAP_PASS
728
729 return false;
730}
731
732static Pass *pass_add(Scene *scene,
733 PassType type,
734 const char *name,
736{
737 Pass *pass = scene->create_node<Pass>();
738
739 pass->set_type(type);
740 pass->set_name(ustring(name));
741 pass->set_mode(mode);
742
743 return pass;
744}
745
746void BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_view_layer)
747{
748 /* Delete all existing passes. */
749 const vector<Pass *> &scene_passes = scene->passes;
750 scene->delete_nodes(set<Pass *>(scene_passes.begin(), scene_passes.end()));
751
752 /* Always add combined pass. */
753 pass_add(scene, PASS_COMBINED, "Combined");
754
755 /* Cryptomatte stores two ID/weight pairs per RGBA layer.
756 * User facing parameter is the number of pairs. */
757 const int crypto_depth = divide_up(min(16, b_view_layer.pass_cryptomatte_depth()), 2);
758 scene->film->set_cryptomatte_depth(crypto_depth);
759 CryptomatteType cryptomatte_passes = CRYPT_NONE;
760 if (b_view_layer.use_pass_cryptomatte_object()) {
761 cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_OBJECT);
762 }
763 if (b_view_layer.use_pass_cryptomatte_material()) {
764 cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_MATERIAL);
765 }
766 if (b_view_layer.use_pass_cryptomatte_asset()) {
767 cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ASSET);
768 }
769 scene->film->set_cryptomatte_passes(cryptomatte_passes);
770
771 unordered_set<string> expected_passes;
772
773 /* Custom AOV passes. */
774 BL::ViewLayer::aovs_iterator b_aov_iter;
775 for (b_view_layer.aovs.begin(b_aov_iter); b_aov_iter != b_view_layer.aovs.end(); ++b_aov_iter) {
776 BL::AOV b_aov(*b_aov_iter);
777 if (!b_aov.is_valid()) {
778 continue;
779 }
780
781 const string name = b_aov.name();
782 const PassType type = (b_aov.type() == BL::AOV::type_COLOR) ? PASS_AOV_COLOR : PASS_AOV_VALUE;
783
784 pass_add(scene, type, name.c_str());
785 expected_passes.insert(name);
786 }
787
788 /* Light Group passes. */
789 BL::ViewLayer::lightgroups_iterator b_lightgroup_iter;
790 for (b_view_layer.lightgroups.begin(b_lightgroup_iter);
791 b_lightgroup_iter != b_view_layer.lightgroups.end();
792 ++b_lightgroup_iter)
793 {
794 BL::Lightgroup b_lightgroup(*b_lightgroup_iter);
795
796 const string name = string_printf("Combined_%s", b_lightgroup.name().c_str());
797
798 Pass *pass = pass_add(scene, PASS_COMBINED, name.c_str(), PassMode::NOISY);
799 pass->set_lightgroup(ustring(b_lightgroup.name()));
800 expected_passes.insert(name);
801 }
802
803 /* Sync the passes that were defined in engine.py. */
804 for (BL::RenderPass &b_pass : b_rlay.passes) {
805 PassType pass_type = PASS_NONE;
806 PassMode pass_mode = PassMode::DENOISED;
807
808 if (!get_known_pass_type(b_pass, pass_type, pass_mode)) {
809 if (!expected_passes.count(b_pass.name())) {
810 LOG(ERROR) << "Unknown pass " << b_pass.name();
811 }
812 continue;
813 }
814
815 if (pass_type == PASS_MOTION &&
816 (b_view_layer.use_motion_blur() && b_scene.render().use_motion_blur()))
817 {
818 continue;
819 }
820
821 pass_add(scene, pass_type, b_pass.name().c_str(), pass_mode);
822 }
823
824 scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
825}
826
827void BlenderSync::free_data_after_sync(BL::Depsgraph &b_depsgraph)
828{
829 /* When viewport display is not needed during render we can force some
830 * caches to be releases from blender side in order to reduce peak memory
831 * footprint during synchronization process.
832 */
833
834 const bool is_interface_locked = b_engine.render() && b_engine.render().use_lock_interface();
835 const bool is_persistent_data = b_engine.render() && b_engine.render().use_persistent_data();
836 const bool can_free_caches =
837 (BlenderSession::headless || is_interface_locked) &&
838 /* Baking re-uses the depsgraph multiple times, clearing crashes
839 * reading un-evaluated mesh data which isn't aligned with the
840 * geometry we're baking, see #71012. */
841 !b_bake_target &&
842 /* Persistent data must main caches for performance and correctness. */
843 !is_persistent_data;
844
845 if (!can_free_caches) {
846 return;
847 }
848 /* TODO(sergey): We can actually remove the whole dependency graph,
849 * but that will need some API support first.
850 */
851 for (BL::Object &b_ob : b_depsgraph.objects) {
852 /* Grease pencil render requires all evaluated objects available as-is after Cycles is done
853 * with its part. */
854 if (b_ob.type() == BL::Object::type_GREASEPENCIL) {
855 continue;
856 }
857 b_ob.cache_release();
858 }
859}
860
861/* Scene Parameters */
862
864 const bool background,
865 const bool use_developer_ui)
866{
868 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
869 const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
870
871 if (shadingsystem == 0) {
872 params.shadingsystem = SHADINGSYSTEM_SVM;
873 }
874 else if (shadingsystem == 1) {
875 params.shadingsystem = SHADINGSYSTEM_OSL;
876 }
877
878 if (background || (use_developer_ui && get_enum(cscene, "debug_bvh_type"))) {
879 params.bvh_type = BVH_TYPE_STATIC;
880 }
881 else {
882 params.bvh_type = BVH_TYPE_DYNAMIC;
883 }
884
885 params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
886 params.use_bvh_compact_structure = RNA_boolean_get(&cscene, "debug_use_compact_bvh");
887 params.use_bvh_unaligned_nodes = RNA_boolean_get(&cscene, "debug_use_hair_bvh");
888 params.num_bvh_time_steps = RNA_int_get(&cscene, "debug_bvh_time_steps");
889
890 PointerRNA csscene = RNA_pointer_get(&b_scene.ptr, "cycles_curves");
891 params.hair_subdivisions = get_int(csscene, "subdivisions");
892 params.hair_shape = (CurveShapeType)get_enum(
893 csscene, "shape", CURVE_NUM_SHAPE_TYPES, CURVE_THICK);
894
895 int texture_limit;
896 if (background) {
897 texture_limit = RNA_enum_get(&cscene, "texture_limit_render");
898 }
899 else {
900 texture_limit = RNA_enum_get(&cscene, "texture_limit");
901 }
902 if (texture_limit > 0 && b_scene.render().use_simplify()) {
903 params.texture_limit = 1 << (texture_limit + 6);
904 }
905 else {
906 params.texture_limit = 0;
907 }
908
909 params.bvh_layout = DebugFlags().cpu.bvh_layout;
910
911 params.background = background;
912
913 return params;
914}
915
916/* Session Parameters */
917
918bool BlenderSync::get_session_pause(BL::Scene &b_scene, bool background)
919{
920 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
921 return (background) ? false : get_boolean(cscene, "preview_pause");
922}
923
925 BL::Preferences &b_preferences,
926 BL::Scene &b_scene,
927 bool background)
928{
930 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
931
932 if (background && !b_engine.is_preview()) {
933 /* Viewport and preview renders do not require temp directory and do request session
934 * parameters more often than the background render.
935 * Optimize RNA-C++ usage and memory allocation a bit by saving string access which we know is
936 * not needed for viewport render. */
937 params.temp_dir = b_engine.temporary_directory();
938 }
939
940 /* feature set */
941 params.experimental = (get_enum(cscene, "feature_set") != 0);
942
943 /* Headless and background rendering. */
945 params.background = background;
946
947 /* Device */
948 params.threads = blender_device_threads(b_scene);
950 b_preferences, b_scene, params.background, b_engine.is_preview(), params.denoise_device);
951
952 /* samples */
953 const int samples = get_int(cscene, "samples");
954 const int preview_samples = get_int(cscene, "preview_samples");
955 const bool use_sample_subset = get_boolean(cscene, "use_sample_subset");
956 const int sample_subset_offset = get_int(cscene, "sample_offset");
957 const int sample_subset_length = get_int(cscene, "sample_subset_length");
958
959 if (background) {
960 params.samples = samples;
961
962 params.use_sample_subset = use_sample_subset;
963 params.sample_subset_offset = sample_subset_offset;
964 params.sample_subset_length = sample_subset_length;
965 }
966 else {
967 params.samples = preview_samples;
968 if (params.samples == 0) {
969 params.samples = INT_MAX;
970 }
971 params.use_sample_subset = false;
972 params.sample_subset_offset = 0;
973 params.sample_subset_length = 0;
974 }
975
976 /* Viewport Performance */
977 params.pixel_size = b_engine.get_preview_pixel_size(b_scene);
978
979 if (background) {
980 params.pixel_size = 1;
981 }
982
983 /* shading system - scene level needs full refresh */
984 const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
985
986 if (shadingsystem == 0) {
987 params.shadingsystem = SHADINGSYSTEM_SVM;
988 }
989 else if (shadingsystem == 1) {
990 params.shadingsystem = SHADINGSYSTEM_OSL;
991 }
992
993 /* Time limit. */
994 if (background) {
995 params.time_limit = (double)get_float(cscene, "time_limit");
996 }
997 else {
998 /* For the viewport it kind of makes more sense to think in terms of the noise floor, which is
999 * usually higher than acceptable level for the final frame. */
1000 /* TODO: It might be useful to support time limit in the viewport as well, but needs some
1001 * extra thoughts and input. */
1002 params.time_limit = 0.0;
1003 }
1004
1005 /* Profiling. */
1006 params.use_profiling = params.device.has_profiling && !b_engine.is_preview() && background &&
1008
1009 if (background) {
1010 params.use_auto_tile = RNA_boolean_get(&cscene, "use_auto_tile");
1011 params.tile_size = max(get_int(cscene, "tile_size"), 8);
1012 }
1013 else {
1014 params.use_auto_tile = false;
1015 }
1016
1017 return params;
1018}
1019
1021 BL::ViewLayer &b_view_layer,
1022 bool background,
1023 const DeviceInfo &denoise_device_info)
1024{
1025 enum DenoiserInput {
1026 DENOISER_INPUT_RGB = 1,
1027 DENOISER_INPUT_RGB_ALBEDO = 2,
1028 DENOISER_INPUT_RGB_ALBEDO_NORMAL = 3,
1029
1030 DENOISER_INPUT_NUM,
1031 };
1032
1033 DenoiseParams denoising;
1034 PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
1035
1036 int input_passes = -1;
1037
1038 if (background) {
1039 /* Final Render Denoising */
1040 denoising.use = get_boolean(cscene, "use_denoising");
1041 denoising.type = (DenoiserType)get_enum(cscene, "denoiser", DENOISER_NUM, DENOISER_NONE);
1042 denoising.use_gpu = get_boolean(cscene, "denoising_use_gpu");
1044 cscene, "denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_NONE);
1045 denoising.quality = (DenoiserQuality)get_enum(
1046 cscene, "denoising_quality", DENOISER_QUALITY_NUM, DENOISER_QUALITY_HIGH);
1047
1048 input_passes = (DenoiserInput)get_enum(
1049 cscene, "denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO_NORMAL);
1050
1051 if (b_view_layer) {
1052 PointerRNA clayer = RNA_pointer_get(&b_view_layer.ptr, "cycles");
1053 if (!get_boolean(clayer, "use_denoising")) {
1054 denoising.use = false;
1055 }
1056 }
1057 }
1058 else {
1059 /* Viewport Denoising */
1060 denoising.use = get_boolean(cscene, "use_preview_denoising");
1061 denoising.type = (DenoiserType)get_enum(
1062 cscene, "preview_denoiser", DENOISER_NUM, DENOISER_NONE);
1063 denoising.use_gpu = get_boolean(cscene, "preview_denoising_use_gpu");
1065 cscene, "preview_denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_FAST);
1066 denoising.quality = (DenoiserQuality)get_enum(
1067 cscene, "preview_denoising_quality", DENOISER_QUALITY_NUM, DENOISER_QUALITY_BALANCED);
1068 denoising.start_sample = get_int(cscene, "preview_denoising_start_sample");
1069
1070 input_passes = (DenoiserInput)get_enum(
1071 cscene, "preview_denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO);
1072
1073 /* Auto select fastest denoiser. */
1074 if (denoising.type == DENOISER_NONE) {
1075 denoising.type = Denoiser::automatic_viewport_denoiser_type(denoise_device_info);
1076 if (denoising.type == DENOISER_NONE) {
1077 denoising.use = false;
1078 }
1079 }
1080 }
1081
1082 switch (input_passes) {
1083 case DENOISER_INPUT_RGB:
1084 denoising.use_pass_albedo = false;
1085 denoising.use_pass_normal = false;
1086 break;
1087
1088 case DENOISER_INPUT_RGB_ALBEDO:
1089 denoising.use_pass_albedo = true;
1090 denoising.use_pass_normal = false;
1091 break;
1092
1093 case DENOISER_INPUT_RGB_ALBEDO_NORMAL:
1094 denoising.use_pass_albedo = true;
1095 denoising.use_pass_normal = true;
1096 break;
1097
1098 default:
1099 LOG(ERROR) << "Unhandled input passes enum " << input_passes;
1100 break;
1101 }
1102
1103 return denoising;
1104}
1105
DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scene, bool background, bool preview, DeviceInfo &preferences_device)
int blender_device_threads(BL::Scene &b_scene)
static unsigned long seed
Definition btSoftBody.h:39
static bool headless
static bool print_render_stats
BlenderSync(BL::RenderEngine &b_engine, BL::BlendData &b_data, BL::Scene &b_scene, Scene *scene, bool preview, bool use_developer_ui, Progress &progress)
Definition sync.cpp:41
static DenoiseParams get_denoise_params(BL::Scene &b_scene, BL::ViewLayer &b_view_layer, bool background, const DeviceInfo &denoise_device)
Definition sync.cpp:1020
void sync_data(BL::RenderSettings &b_render, BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, BL::Object &b_override, const int width, const int height, void **python_thread_state, const DeviceInfo &denoise_device_info)
Definition sync.cpp:279
static bool get_session_pause(BL::Scene &b_scene, bool background)
Definition sync.cpp:918
void tag_update()
Definition sync.cpp:85
static SessionParams get_session_params(BL::RenderEngine &b_engine, BL::Preferences &b_preferences, BL::Scene &b_scene, bool background)
Definition sync.cpp:924
void sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, BL::RegionView3D &b_rv3d)
Definition sync.cpp:97
void sync_view_layer(BL::ViewLayer &b_view_layer)
Definition sync.cpp:605
void sync_integrator(BL::ViewLayer &b_view_layer, bool background, const DeviceInfo &denoise_device_info)
Definition sync.cpp:333
void free_data_after_sync(BL::Depsgraph &b_depsgraph)
Definition sync.cpp:827
static SceneParams get_scene_params(BL::Scene &b_scene, const bool background, const bool use_developer_ui)
Definition sync.cpp:863
void reset(BL::BlendData &b_data, BL::Scene &b_scene)
Definition sync.cpp:75
void set_bake_target(BL::Object &b_object)
Definition sync.cpp:90
void sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_view_layer)
Definition sync.cpp:746
CPU cpu
Definition debug.h:120
DenoiserType type
Definition denoise.h:59
DenoiserQuality quality
Definition denoise.h:76
bool use_gpu
Definition denoise.h:73
int start_sample
Definition denoise.h:62
DenoiserPrefilter prefilter
Definition denoise.h:75
NODE_DECLARE bool use
Definition denoise.h:56
bool use_pass_normal
Definition denoise.h:66
bool use_pass_albedo
Definition denoise.h:65
static DenoiserType automatic_viewport_denoiser_type(const DeviceInfo &denoise_device_info)
Definition denoiser.cpp:184
Definition film.h:29
bool is_mesh() const
bool set_animation_frame_update(const int frame)
void tag_update(Scene *scene, const uint32_t flag)
AdaptiveSampling get_adaptive_sampling() const
Definition pass.h:49
static bool image_is_builtin(BL::Image &ima, BL::RenderEngine &engine)
static float get_float(PointerRNA &ptr, const char *name)
static bool get_boolean(PointerRNA &ptr, const char *name)
static int get_int(PointerRNA &ptr, const char *name)
static int get_enum(PointerRNA &ptr, const char *name, int num_values=-1, int default_value=-1)
static Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob, const bool preview, const bool use_adaptive_subdivision)
static CCL_NAMESPACE_BEGIN BL::ID object_get_data(const BL::Object &b_ob, const bool use_adaptive_subdivision)
static bool region_view3d_navigating_or_transforming(const BL::RegionView3D &b_rv3d)
DebugFlags & DebugFlags()
Definition debug.h:145
DenoiserQuality
Definition denoise.h:41
@ DENOISER_QUALITY_NUM
Definition denoise.h:45
@ DENOISER_QUALITY_BALANCED
Definition denoise.h:43
@ DENOISER_QUALITY_HIGH
Definition denoise.h:42
DenoiserPrefilter
Definition denoise.h:25
@ DENOISER_PREFILTER_FAST
Definition denoise.h:32
@ DENOISER_PREFILTER_NONE
Definition denoise.h:28
@ DENOISER_PREFILTER_NUM
Definition denoise.h:38
DenoiserType
Definition denoise.h:11
@ DENOISER_NONE
Definition denoise.h:16
@ DENOISER_NUM
Definition denoise.h:14
#define CCL_NAMESPACE_END
#define sqrtf(x)
FilterType
Definition film.h:21
@ FILTER_NUM_TYPES
Definition film.h:26
@ FILTER_BOX
Definition film.h:22
@ FILTER_BLACKMAN_HARRIS
Definition film.h:24
ccl_device_inline uint hash_uint2(const uint kx, const uint ky)
Definition hash.h:90
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
DirectLightSamplingType
@ DIRECT_LIGHT_SAMPLING_MIS
@ DIRECT_LIGHT_SAMPLING_NUM
CryptomatteType
@ CRYPT_ASSET
@ CRYPT_NONE
@ CRYPT_OBJECT
@ CRYPT_MATERIAL
CurveShapeType
@ CURVE_THICK
@ CURVE_NUM_SHAPE_TYPES
@ MOTION_POSITION_CENTER
GuidingDirectionalSamplingType
@ GUIDING_DIRECTIONAL_SAMPLING_NUM_TYPES
@ GUIDING_DIRECTIONAL_SAMPLING_TYPE_RIS
SamplingPattern
@ SAMPLING_PATTERN_AUTOMATIC
@ SAMPLING_PATTERN_BLUE_NOISE_FIRST
@ SAMPLING_PATTERN_TABULATED_SOBOL
@ SAMPLING_PATTERN_BLUE_NOISE_PURE
@ SAMPLING_NUM_PATTERNS
PassType
@ PASS_EMISSION
@ PASS_POSITION
@ PASS_BACKGROUND
@ PASS_TRANSMISSION_DIRECT
@ PASS_VOLUME_DIRECT
@ PASS_UV
@ PASS_TRANSMISSION_COLOR
@ PASS_GUIDING_COLOR
@ PASS_DEPTH
@ PASS_MIST
@ PASS_TRANSMISSION_INDIRECT
@ PASS_BAKE_SEED
@ PASS_SHADOW_CATCHER
@ PASS_DENOISING_NORMAL
@ PASS_DIFFUSE_DIRECT
@ PASS_MOTION
@ PASS_MATERIAL_ID
@ PASS_AO
@ PASS_COMBINED
@ PASS_DIFFUSE_INDIRECT
@ PASS_GUIDING_PROBABILITY
@ PASS_ADAPTIVE_AUX_BUFFER
@ PASS_OBJECT_ID
@ PASS_AOV_COLOR
@ PASS_NONE
@ PASS_VOLUME_INDIRECT
@ PASS_NORMAL
@ PASS_CRYPTOMATTE
@ PASS_DIFFUSE_COLOR
@ PASS_SAMPLE_COUNT
@ PASS_GLOSSY_DIRECT
@ PASS_DENOISING_ALBEDO
@ PASS_AOV_VALUE
@ PASS_GUIDING_AVG_ROUGHNESS
@ PASS_GLOSSY_COLOR
@ PASS_GLOSSY_INDIRECT
@ PASS_BAKE_DIFFERENTIAL
@ PASS_DENOISING_DEPTH
@ PASS_BAKE_PRIMITIVE
GuidingDistributionType
@ GUIDING_NUM_TYPES
@ GUIDING_TYPE_PARALLAX_AWARE_VMM
#define VLOG_INFO
Definition log.h:71
#define LOG(severity)
Definition log.h:32
@ BVH_TYPE_DYNAMIC
Definition params.h:33
@ BVH_TYPE_STATIC
Definition params.h:40
PassMode
Definition pass.h:20
@ DENOISED
Definition pass.h:22
@ NOISY
Definition pass.h:21
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
const PointerRNA PointerRNA_NULL
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_id_pointer_create(ID *id)
@ SHADINGSYSTEM_OSL
@ SHADINGSYSTEM_SVM
#define min(a, b)
Definition sort.cc:36
bool string_startswith(const string_view s, const string_view start)
Definition string.cpp:104
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
Definition string.cpp:23
BVHLayout bvh_layout
Definition debug.h:47
Definition DNA_ID.h:404
@ SUBDIVISION_NONE
Definition scene/mesh.h:118
ustring name
Definition graph/node.h:177
Film * film
Definition scene.h:128
T * create_node(Args &&...)=delete
@ MOTION_PASS
Definition scene.h:184
@ MOTION_NONE
Definition scene.h:184
static bool get_known_pass_type(BL::RenderPass &b_pass, PassType &type, PassMode &mode)
Definition sync.cpp:660
#define MAP_PASS(passname, passtype, noisy)
static Pass * pass_add(Scene *scene, PassType type, const char *name, PassMode mode=PassMode::DENOISED)
Definition sync.cpp:732
static CCL_NAMESPACE_BEGIN const char * cryptomatte_prefix
Definition sync.cpp:37
max
Definition text_draw.cc:251
ccl_device_inline bool is_light(const ccl_global KernelLightTreeEmitter *kemitter)
Definition tree.h:69
ccl_device_inline size_t divide_up(const size_t x, const size_t y)
Definition types_base.h:52
wmTimer * timer