Blender  V2.93
film.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "render/film.h"
18 #include "device/device.h"
19 #include "render/camera.h"
20 #include "render/integrator.h"
21 #include "render/mesh.h"
22 #include "render/scene.h"
23 #include "render/stats.h"
24 #include "render/tables.h"
25 
26 #include "util/util_algorithm.h"
27 #include "util/util_foreach.h"
28 #include "util/util_math.h"
29 #include "util/util_math_cdf.h"
30 #include "util/util_time.h"
31 
33 
34 /* Pass */
35 
36 static bool compare_pass_order(const Pass &a, const Pass &b)
37 {
38  if (a.components == b.components)
39  return (a.type < b.type);
40  return (a.components > b.components);
41 }
42 
44 {
45  static NodeEnum pass_type_enum;
46  pass_type_enum.insert("combined", PASS_COMBINED);
47  pass_type_enum.insert("depth", PASS_DEPTH);
48  pass_type_enum.insert("normal", PASS_NORMAL);
49  pass_type_enum.insert("uv", PASS_UV);
50  pass_type_enum.insert("object_id", PASS_OBJECT_ID);
51  pass_type_enum.insert("material_id", PASS_MATERIAL_ID);
52  pass_type_enum.insert("motion", PASS_MOTION);
53  pass_type_enum.insert("motion_weight", PASS_MOTION_WEIGHT);
54 #ifdef __KERNEL_DEBUG__
55  pass_type_enum.insert("traversed_nodes", PASS_BVH_TRAVERSED_NODES);
56  pass_type_enum.insert("traverse_instances", PASS_BVH_TRAVERSED_INSTANCES);
57  pass_type_enum.insert("bvh_intersections", PASS_BVH_INTERSECTIONS);
58  pass_type_enum.insert("ray_bounces", PASS_RAY_BOUNCES);
59 #endif
60  pass_type_enum.insert("render_time", PASS_RENDER_TIME);
61  pass_type_enum.insert("cryptomatte", PASS_CRYPTOMATTE);
62  pass_type_enum.insert("aov_color", PASS_AOV_COLOR);
63  pass_type_enum.insert("aov_value", PASS_AOV_VALUE);
64  pass_type_enum.insert("adaptive_aux_buffer", PASS_ADAPTIVE_AUX_BUFFER);
65  pass_type_enum.insert("sample_count", PASS_SAMPLE_COUNT);
66  pass_type_enum.insert("mist", PASS_MIST);
67  pass_type_enum.insert("emission", PASS_EMISSION);
68  pass_type_enum.insert("background", PASS_BACKGROUND);
69  pass_type_enum.insert("ambient_occlusion", PASS_AO);
70  pass_type_enum.insert("shadow", PASS_SHADOW);
71  pass_type_enum.insert("diffuse_direct", PASS_DIFFUSE_DIRECT);
72  pass_type_enum.insert("diffuse_indirect", PASS_DIFFUSE_INDIRECT);
73  pass_type_enum.insert("diffuse_color", PASS_DIFFUSE_COLOR);
74  pass_type_enum.insert("glossy_direct", PASS_GLOSSY_DIRECT);
75  pass_type_enum.insert("glossy_indirect", PASS_GLOSSY_INDIRECT);
76  pass_type_enum.insert("glossy_color", PASS_GLOSSY_COLOR);
77  pass_type_enum.insert("transmission_direct", PASS_TRANSMISSION_DIRECT);
78  pass_type_enum.insert("transmission_indirect", PASS_TRANSMISSION_INDIRECT);
79  pass_type_enum.insert("transmission_color", PASS_TRANSMISSION_COLOR);
80  pass_type_enum.insert("volume_direct", PASS_VOLUME_DIRECT);
81  pass_type_enum.insert("volume_indirect", PASS_VOLUME_INDIRECT);
82  pass_type_enum.insert("bake_primitive", PASS_BAKE_PRIMITIVE);
83  pass_type_enum.insert("bake_differential", PASS_BAKE_DIFFERENTIAL);
84 
85  return &pass_type_enum;
86 }
87 
89 {
90  NodeType *type = NodeType::add("pass", create);
91 
92  NodeEnum *pass_type_enum = get_pass_type_enum();
93  SOCKET_ENUM(type, "Type", *pass_type_enum, PASS_COMBINED);
94  SOCKET_STRING(name, "Name", ustring());
95 
96  return type;
97 }
98 
99 Pass::Pass() : Node(get_node_type())
100 {
101 }
102 
103 void Pass::add(PassType type, vector<Pass> &passes, const char *name)
104 {
105  for (size_t i = 0; i < passes.size(); i++) {
106  if (passes[i].type != type) {
107  continue;
108  }
109 
110  /* An empty name is used as a placeholder to signal that any pass of
111  * that type is fine (because the content always is the same).
112  * This is important to support divide_type: If the pass that has a
113  * divide_type is added first, a pass for divide_type with an empty
114  * name will be added. Then, if a matching pass with a name is later
115  * requested, the existing placeholder will be renamed to that.
116  * If the divide_type is explicitly allocated with a name first and
117  * then again as part of another pass, the second one will just be
118  * skipped because that type already exists. */
119 
120  /* If no name is specified, any pass of the correct type will match. */
121  if (name == NULL) {
122  return;
123  }
124 
125  /* If we already have a placeholder pass, rename that one. */
126  if (passes[i].name.empty()) {
127  passes[i].name = name;
128  return;
129  }
130 
131  /* If neither existing nor requested pass have placeholder name, they
132  * must match. */
133  if (name == passes[i].name) {
134  return;
135  }
136  }
137 
138  Pass pass;
139 
140  pass.type = type;
141  pass.filter = true;
142  pass.exposure = false;
143  pass.divide_type = PASS_NONE;
144  if (name) {
145  pass.name = name;
146  }
147 
148  switch (type) {
149  case PASS_NONE:
150  pass.components = 0;
151  break;
152  case PASS_COMBINED:
153  pass.components = 4;
154  pass.exposure = true;
155  break;
156  case PASS_DEPTH:
157  pass.components = 1;
158  pass.filter = false;
159  break;
160  case PASS_MIST:
161  pass.components = 1;
162  break;
163  case PASS_NORMAL:
164  pass.components = 4;
165  break;
166  case PASS_UV:
167  pass.components = 4;
168  break;
169  case PASS_MOTION:
170  pass.components = 4;
172  break;
173  case PASS_MOTION_WEIGHT:
174  pass.components = 1;
175  break;
176  case PASS_OBJECT_ID:
177  case PASS_MATERIAL_ID:
178  pass.components = 1;
179  pass.filter = false;
180  break;
181 
182  case PASS_EMISSION:
183  case PASS_BACKGROUND:
184  pass.components = 4;
185  pass.exposure = true;
186  break;
187  case PASS_AO:
188  pass.components = 4;
189  break;
190  case PASS_SHADOW:
191  pass.components = 4;
192  pass.exposure = false;
193  break;
194  case PASS_LIGHT:
195  /* This isn't a real pass, used by baking to see whether
196  * light data is needed or not.
197  *
198  * Set components to 0 so pass sort below happens in a
199  * determined way.
200  */
201  pass.components = 0;
202  break;
203 #ifdef WITH_CYCLES_DEBUG
204  case PASS_BVH_TRAVERSED_NODES:
205  case PASS_BVH_TRAVERSED_INSTANCES:
206  case PASS_BVH_INTERSECTIONS:
207  case PASS_RAY_BOUNCES:
208  pass.components = 1;
209  pass.exposure = false;
210  break;
211 #endif
212  case PASS_RENDER_TIME:
213  /* This pass is handled entirely on the host side. */
214  pass.components = 0;
215  break;
216 
217  case PASS_DIFFUSE_COLOR:
218  case PASS_GLOSSY_COLOR:
220  pass.components = 4;
221  break;
222  case PASS_DIFFUSE_DIRECT:
224  pass.components = 4;
225  pass.exposure = true;
227  break;
228  case PASS_GLOSSY_DIRECT:
230  pass.components = 4;
231  pass.exposure = true;
233  break;
236  pass.components = 4;
237  pass.exposure = true;
239  break;
240  case PASS_VOLUME_DIRECT:
242  pass.components = 4;
243  pass.exposure = true;
244  break;
245  case PASS_CRYPTOMATTE:
246  pass.components = 4;
247  break;
249  pass.components = 4;
250  break;
251  case PASS_SAMPLE_COUNT:
252  pass.components = 1;
253  pass.exposure = false;
254  break;
255  case PASS_AOV_COLOR:
256  pass.components = 4;
257  break;
258  case PASS_AOV_VALUE:
259  pass.components = 1;
260  break;
261  case PASS_BAKE_PRIMITIVE:
263  pass.components = 4;
264  pass.exposure = false;
265  pass.filter = false;
266  break;
267  default:
268  assert(false);
269  break;
270  }
271 
272  passes.push_back(pass);
273 
274  /* Order from by components, to ensure alignment so passes with size 4
275  * come first and then passes with size 1. Note this must use stable sort
276  * so cryptomatte passes remain in the right order. */
277  stable_sort(&passes[0], &passes[0] + passes.size(), compare_pass_order);
278 
279  if (pass.divide_type != PASS_NONE)
280  Pass::add(pass.divide_type, passes);
281 }
282 
284 {
285  if (A.size() != B.size())
286  return false;
287 
288  for (int i = 0; i < A.size(); i++)
289  if (A[i].type != B[i].type || A[i].name != B[i].name)
290  return false;
291 
292  return true;
293 }
294 
296 {
297  for (size_t i = 0; i < passes.size(); i++)
298  if (passes[i].type == type)
299  return true;
300 
301  return false;
302 }
303 
304 /* Pixel Filter */
305 
306 static float filter_func_box(float /*v*/, float /*width*/)
307 {
308  return 1.0f;
309 }
310 
311 static float filter_func_gaussian(float v, float width)
312 {
313  v *= 6.0f / width;
314  return expf(-2.0f * v * v);
315 }
316 
317 static float filter_func_blackman_harris(float v, float width)
318 {
319  v = M_2PI_F * (v / width + 0.5f);
320  return 0.35875f - 0.48829f * cosf(v) + 0.14128f * cosf(2.0f * v) - 0.01168f * cosf(3.0f * v);
321 }
322 
324 {
326  float (*filter_func)(float, float) = NULL;
327 
328  switch (type) {
329  case FILTER_BOX:
330  filter_func = filter_func_box;
331  break;
332  case FILTER_GAUSSIAN:
333  filter_func = filter_func_gaussian;
334  width *= 3.0f;
335  break;
337  filter_func = filter_func_blackman_harris;
338  width *= 2.0f;
339  break;
340  default:
341  assert(0);
342  }
343 
344  /* Create importance sampling table. */
345 
346  /* TODO(sergey): With the even filter table size resolution we can not
347  * really make it nice symmetric importance map without sampling full range
348  * (meaning, we would need to sample full filter range and not use the
349  * make_symmetric argument).
350  *
351  * Current code matches exactly initial filter table code, but we should
352  * consider either making FILTER_TABLE_SIZE odd value or sample full filter.
353  */
354 
356  0.0f,
357  width * 0.5f,
358  function_bind(filter_func, _1, width),
359  true,
360  filter_table);
361 
362  return filter_table;
363 }
364 
365 /* Film */
366 
368 {
369  NodeType *type = NodeType::add("film", create);
370 
371  SOCKET_FLOAT(exposure, "Exposure", 0.8f);
372  SOCKET_FLOAT(pass_alpha_threshold, "Pass Alpha Threshold", 0.0f);
373 
374  static NodeEnum filter_enum;
375  filter_enum.insert("box", FILTER_BOX);
376  filter_enum.insert("gaussian", FILTER_GAUSSIAN);
377  filter_enum.insert("blackman_harris", FILTER_BLACKMAN_HARRIS);
378 
379  SOCKET_ENUM(filter_type, "Filter Type", filter_enum, FILTER_BOX);
380  SOCKET_FLOAT(filter_width, "Filter Width", 1.0f);
381 
382  SOCKET_FLOAT(mist_start, "Mist Start", 0.0f);
383  SOCKET_FLOAT(mist_depth, "Mist Depth", 100.0f);
384  SOCKET_FLOAT(mist_falloff, "Mist Falloff", 1.0f);
385 
386  SOCKET_BOOLEAN(denoising_data_pass, "Generate Denoising Data Pass", false);
387  SOCKET_BOOLEAN(denoising_clean_pass, "Generate Denoising Clean Pass", false);
388  SOCKET_BOOLEAN(denoising_prefiltered_pass, "Generate Denoising Prefiltered Pass", false);
389  SOCKET_INT(denoising_flags, "Denoising Flags", 0);
390  SOCKET_BOOLEAN(use_adaptive_sampling, "Use Adaptive Sampling", false);
391 
392  SOCKET_BOOLEAN(use_light_visibility, "Use Light Visibility", false);
393 
394  NodeEnum *pass_type_enum = get_pass_type_enum();
395  SOCKET_ENUM(display_pass, "Display Pass", *pass_type_enum, PASS_COMBINED);
396 
397  static NodeEnum cryptomatte_passes_enum;
398  cryptomatte_passes_enum.insert("none", CRYPT_NONE);
399  cryptomatte_passes_enum.insert("object", CRYPT_OBJECT);
400  cryptomatte_passes_enum.insert("material", CRYPT_MATERIAL);
401  cryptomatte_passes_enum.insert("asset", CRYPT_ASSET);
402  cryptomatte_passes_enum.insert("accurate", CRYPT_ACCURATE);
403  SOCKET_ENUM(cryptomatte_passes, "Cryptomatte Passes", cryptomatte_passes_enum, CRYPT_NONE);
404 
405  SOCKET_INT(cryptomatte_depth, "Cryptomatte Depth", 0);
406 
407  return type;
408 }
409 
410 Film::Film() : Node(get_node_type())
411 {
412  use_light_visibility = false;
413  filter_table_offset = TABLE_OFFSET_INVALID;
414  cryptomatte_passes = CRYPT_NONE;
415  display_pass = PASS_COMBINED;
416 }
417 
419 {
420 }
421 
423 {
425 }
426 
428 {
429  if (!is_modified())
430  return;
431 
432  scoped_callback_timer timer([scene](double time) {
433  if (scene->update_stats) {
434  scene->update_stats->film.times.add_entry({"update", time});
435  }
436  });
437 
438  device_free(device, dscene, scene);
439 
440  KernelFilm *kfilm = &dscene->data.film;
441 
442  /* update __data */
443  kfilm->exposure = exposure;
444  kfilm->pass_flag = 0;
445 
446  kfilm->display_pass_stride = -1;
447  kfilm->display_pass_components = 0;
448  kfilm->display_divide_pass_stride = -1;
449  kfilm->use_display_exposure = false;
450  kfilm->use_display_pass_alpha = (display_pass == PASS_COMBINED);
451 
452  kfilm->light_pass_flag = 0;
453  kfilm->pass_stride = 0;
454  kfilm->use_light_pass = use_light_visibility;
455  kfilm->pass_aov_value_num = 0;
456  kfilm->pass_aov_color_num = 0;
457 
458  bool have_cryptomatte = false;
459 
460  for (size_t i = 0; i < scene->passes.size(); i++) {
461  Pass &pass = scene->passes[i];
462 
463  if (pass.type == PASS_NONE) {
464  continue;
465  }
466 
467  /* Can't do motion pass if no motion vectors are available. */
468  if (pass.type == PASS_MOTION || pass.type == PASS_MOTION_WEIGHT) {
470  kfilm->pass_stride += pass.components;
471  continue;
472  }
473  }
474 
475  int pass_flag = (1 << (pass.type % 32));
476  if (pass.type <= PASS_CATEGORY_MAIN_END) {
477  kfilm->pass_flag |= pass_flag;
478  }
479  else if (pass.type <= PASS_CATEGORY_LIGHT_END) {
480  kfilm->use_light_pass = 1;
481  kfilm->light_pass_flag |= pass_flag;
482  }
483  else {
484  assert(pass.type <= PASS_CATEGORY_BAKE_END);
485  }
486 
487  switch (pass.type) {
488  case PASS_COMBINED:
489  kfilm->pass_combined = kfilm->pass_stride;
490  break;
491  case PASS_DEPTH:
492  kfilm->pass_depth = kfilm->pass_stride;
493  break;
494  case PASS_NORMAL:
495  kfilm->pass_normal = kfilm->pass_stride;
496  break;
497  case PASS_UV:
498  kfilm->pass_uv = kfilm->pass_stride;
499  break;
500  case PASS_MOTION:
501  kfilm->pass_motion = kfilm->pass_stride;
502  break;
503  case PASS_MOTION_WEIGHT:
504  kfilm->pass_motion_weight = kfilm->pass_stride;
505  break;
506  case PASS_OBJECT_ID:
507  kfilm->pass_object_id = kfilm->pass_stride;
508  break;
509  case PASS_MATERIAL_ID:
510  kfilm->pass_material_id = kfilm->pass_stride;
511  break;
512 
513  case PASS_MIST:
514  kfilm->pass_mist = kfilm->pass_stride;
515  break;
516  case PASS_EMISSION:
517  kfilm->pass_emission = kfilm->pass_stride;
518  break;
519  case PASS_BACKGROUND:
520  kfilm->pass_background = kfilm->pass_stride;
521  break;
522  case PASS_AO:
523  kfilm->pass_ao = kfilm->pass_stride;
524  break;
525  case PASS_SHADOW:
526  kfilm->pass_shadow = kfilm->pass_stride;
527  break;
528 
529  case PASS_LIGHT:
530  break;
531 
532  case PASS_DIFFUSE_COLOR:
533  kfilm->pass_diffuse_color = kfilm->pass_stride;
534  break;
535  case PASS_GLOSSY_COLOR:
536  kfilm->pass_glossy_color = kfilm->pass_stride;
537  break;
539  kfilm->pass_transmission_color = kfilm->pass_stride;
540  break;
542  kfilm->pass_diffuse_indirect = kfilm->pass_stride;
543  break;
545  kfilm->pass_glossy_indirect = kfilm->pass_stride;
546  break;
548  kfilm->pass_transmission_indirect = kfilm->pass_stride;
549  break;
551  kfilm->pass_volume_indirect = kfilm->pass_stride;
552  break;
553  case PASS_DIFFUSE_DIRECT:
554  kfilm->pass_diffuse_direct = kfilm->pass_stride;
555  break;
556  case PASS_GLOSSY_DIRECT:
557  kfilm->pass_glossy_direct = kfilm->pass_stride;
558  break;
560  kfilm->pass_transmission_direct = kfilm->pass_stride;
561  break;
562  case PASS_VOLUME_DIRECT:
563  kfilm->pass_volume_direct = kfilm->pass_stride;
564  break;
565 
566  case PASS_BAKE_PRIMITIVE:
567  kfilm->pass_bake_primitive = kfilm->pass_stride;
568  break;
570  kfilm->pass_bake_differential = kfilm->pass_stride;
571  break;
572 
573 #ifdef WITH_CYCLES_DEBUG
574  case PASS_BVH_TRAVERSED_NODES:
575  kfilm->pass_bvh_traversed_nodes = kfilm->pass_stride;
576  break;
577  case PASS_BVH_TRAVERSED_INSTANCES:
578  kfilm->pass_bvh_traversed_instances = kfilm->pass_stride;
579  break;
580  case PASS_BVH_INTERSECTIONS:
581  kfilm->pass_bvh_intersections = kfilm->pass_stride;
582  break;
583  case PASS_RAY_BOUNCES:
584  kfilm->pass_ray_bounces = kfilm->pass_stride;
585  break;
586 #endif
587  case PASS_RENDER_TIME:
588  break;
589  case PASS_CRYPTOMATTE:
590  kfilm->pass_cryptomatte = have_cryptomatte ?
591  min(kfilm->pass_cryptomatte, kfilm->pass_stride) :
592  kfilm->pass_stride;
593  have_cryptomatte = true;
594  break;
596  kfilm->pass_adaptive_aux_buffer = kfilm->pass_stride;
597  break;
598  case PASS_SAMPLE_COUNT:
599  kfilm->pass_sample_count = kfilm->pass_stride;
600  break;
601  case PASS_AOV_COLOR:
602  if (kfilm->pass_aov_color_num == 0) {
603  kfilm->pass_aov_color = kfilm->pass_stride;
604  }
605  kfilm->pass_aov_color_num++;
606  break;
607  case PASS_AOV_VALUE:
608  if (kfilm->pass_aov_value_num == 0) {
609  kfilm->pass_aov_value = kfilm->pass_stride;
610  }
611  kfilm->pass_aov_value_num++;
612  break;
613  default:
614  assert(false);
615  break;
616  }
617 
618  if (pass.type == display_pass) {
619  kfilm->display_pass_stride = kfilm->pass_stride;
620  kfilm->display_pass_components = pass.components;
621  kfilm->use_display_exposure = pass.exposure && (kfilm->exposure != 1.0f);
622  }
623  else if (pass.type == PASS_DIFFUSE_COLOR || pass.type == PASS_TRANSMISSION_COLOR ||
624  pass.type == PASS_GLOSSY_COLOR) {
625  kfilm->display_divide_pass_stride = kfilm->pass_stride;
626  }
627 
628  kfilm->pass_stride += pass.components;
629  }
630 
631  kfilm->pass_denoising_data = 0;
632  kfilm->pass_denoising_clean = 0;
633  kfilm->denoising_flags = 0;
634  if (denoising_data_pass) {
635  kfilm->pass_denoising_data = kfilm->pass_stride;
637  kfilm->denoising_flags = denoising_flags;
638  if (denoising_clean_pass) {
639  kfilm->pass_denoising_clean = kfilm->pass_stride;
641  kfilm->use_light_pass = 1;
642  }
643  if (denoising_prefiltered_pass) {
645  }
646  }
647 
648  kfilm->pass_stride = align_up(kfilm->pass_stride, 4);
649 
650  /* When displaying the normal/uv pass in the viewport we need to disable
651  * transparency.
652  *
653  * We also don't need to perform light accumulations. Later we want to optimize this to suppress
654  * light calculations. */
655  if (display_pass == PASS_NORMAL || display_pass == PASS_UV) {
656  kfilm->use_light_pass = 0;
657  }
658  else {
659  kfilm->pass_alpha_threshold = pass_alpha_threshold;
660  }
661 
662  /* update filter table */
663  vector<float> table = filter_table(filter_type, filter_width);
664  scene->lookup_tables->remove_table(&filter_table_offset);
665  filter_table_offset = scene->lookup_tables->add_table(dscene, table);
666  kfilm->filter_table_offset = (int)filter_table_offset;
667 
668  /* mist pass parameters */
669  kfilm->mist_start = mist_start;
670  kfilm->mist_inv_depth = (mist_depth > 0.0f) ? 1.0f / mist_depth : 0.0f;
671  kfilm->mist_falloff = mist_falloff;
672 
673  kfilm->cryptomatte_passes = cryptomatte_passes;
674  kfilm->cryptomatte_depth = cryptomatte_depth;
675 
676  pass_stride = kfilm->pass_stride;
677  denoising_data_offset = kfilm->pass_denoising_data;
678  denoising_clean_offset = kfilm->pass_denoising_clean;
679 
680  clear_modified();
681 }
682 
683 void Film::device_free(Device * /*device*/, DeviceScene * /*dscene*/, Scene *scene)
684 {
685  scene->lookup_tables->remove_table(&filter_table_offset);
686 }
687 
688 void Film::tag_passes_update(Scene *scene, const vector<Pass> &passes_, bool update_passes)
689 {
692 
693  foreach (Shader *shader, scene->shaders)
694  shader->need_update_uvs = true;
695  }
698  }
699  else if (Pass::contains(scene->passes, PASS_AO) != Pass::contains(passes_, PASS_AO)) {
701  }
702 
703  if (update_passes) {
704  scene->passes = passes_;
705  }
706 }
707 
708 int Film::get_aov_offset(Scene *scene, string name, bool &is_color)
709 {
710  int num_color = 0, num_value = 0;
711  foreach (const Pass &pass, scene->passes) {
712  if (pass.type == PASS_AOV_COLOR) {
713  num_color++;
714  }
715  else if (pass.type == PASS_AOV_VALUE) {
716  num_value++;
717  }
718  else {
719  continue;
720  }
721 
722  if (pass.name == name) {
723  is_color = (pass.type == PASS_AOV_COLOR);
724  return (is_color ? num_color : num_value) - 1;
725  }
726  }
727 
728  return -1;
729 }
730 
732 {
733  return pass_stride;
734 }
735 
737 {
738  return denoising_data_offset;
739 }
740 
742 {
743  return denoising_clean_offset;
744 }
745 
747 {
748  return filter_table_offset;
749 }
750 
typedef float(TangentPoint)[2]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define A
Definition: device.h:293
Definition: film.h:59
int get_denoising_data_offset() const
Definition: film.cpp:736
int get_pass_stride() const
Definition: film.cpp:731
int get_aov_offset(Scene *scene, string name, bool &is_color)
Definition: film.cpp:708
~Film()
Definition: film.cpp:418
static void add_default(Scene *scene)
Definition: film.cpp:422
size_t get_filter_table_offset() const
Definition: film.cpp:746
void device_free(Device *device, DeviceScene *dscene, Scene *scene)
Definition: film.cpp:683
void device_update(Device *device, DeviceScene *dscene, Scene *scene)
Definition: film.cpp:427
int get_denoising_clean_offset() const
Definition: film.cpp:741
Film()
Definition: film.cpp:410
void tag_passes_update(Scene *scene, const vector< Pass > &passes_, bool update_passes=true)
Definition: film.cpp:688
void tag_update(Scene *scene, uint32_t flag)
Definition: geometry.cpp:2127
void tag_update(Scene *scene, uint32_t flag)
Definition: integrator.cpp:292
@ AO_PASS_MODIFIED
Definition: integrator.h:93
size_t add_table(DeviceScene *dscene, vector< float > &data)
Definition: tables.cpp:73
void remove_table(size_t *offset)
Definition: tables.cpp:108
Definition: film.h:41
PassType divide_type
Definition: film.h:51
NODE_DECLARE Pass()
Definition: film.cpp:99
ustring name
Definition: film.h:52
static bool contains(const vector< Pass > &passes, PassType)
Definition: film.cpp:295
PassType type
Definition: film.h:47
bool filter
Definition: film.h:49
int components
Definition: film.h:48
static bool equals(const vector< Pass > &A, const vector< Pass > &B)
Definition: film.cpp:283
bool exposure
Definition: film.h:50
static void add(PassType type, vector< Pass > &passes, const char *name=NULL)
Definition: film.cpp:103
Definition: shader.h:80
double time
Scene scene
#define function_bind
static float filter_func_gaussian(float v, float width)
Definition: film.cpp:311
static CCL_NAMESPACE_BEGIN bool compare_pass_order(const Pass &a, const Pass &b)
Definition: film.cpp:36
NODE_DEFINE(Pass)
Definition: film.cpp:88
static float filter_func_blackman_harris(float v, float width)
Definition: film.cpp:317
static vector< float > filter_table(FilterType type, float width)
Definition: film.cpp:323
static NodeEnum * get_pass_type_enum()
Definition: film.cpp:43
static float filter_func_box(float, float)
Definition: film.cpp:306
FilterType
Definition: film.h:33
@ FILTER_BOX
Definition: film.h:34
@ FILTER_BLACKMAN_HARRIS
Definition: film.h:36
@ FILTER_GAUSSIAN
Definition: film.h:35
#define cosf(x)
#define expf(x)
#define CCL_NAMESPACE_END
void KERNEL_FUNCTION_FULL_NAME() shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int filter, int i, int offset, int sample)
#define FILTER_TABLE_SIZE
Definition: kernel_types.h:45
@ CRYPT_ASSET
Definition: kernel_types.h:404
@ CRYPT_NONE
Definition: kernel_types.h:401
@ CRYPT_ACCURATE
Definition: kernel_types.h:405
@ CRYPT_OBJECT
Definition: kernel_types.h:402
@ CRYPT_MATERIAL
Definition: kernel_types.h:403
PassType
Definition: kernel_types.h:347
@ PASS_EMISSION
Definition: kernel_types.h:374
@ PASS_BACKGROUND
Definition: kernel_types.h:375
@ PASS_TRANSMISSION_DIRECT
Definition: kernel_types.h:385
@ PASS_VOLUME_DIRECT
Definition: kernel_types.h:388
@ PASS_UV
Definition: kernel_types.h:354
@ PASS_TRANSMISSION_COLOR
Definition: kernel_types.h:387
@ PASS_DEPTH
Definition: kernel_types.h:352
@ PASS_MIST
Definition: kernel_types.h:373
@ PASS_TRANSMISSION_INDIRECT
Definition: kernel_types.h:386
@ PASS_DIFFUSE_DIRECT
Definition: kernel_types.h:379
@ PASS_MOTION
Definition: kernel_types.h:357
@ PASS_CATEGORY_BAKE_END
Definition: kernel_types.h:395
@ PASS_MATERIAL_ID
Definition: kernel_types.h:356
@ PASS_AO
Definition: kernel_types.h:376
@ PASS_COMBINED
Definition: kernel_types.h:351
@ PASS_DIFFUSE_INDIRECT
Definition: kernel_types.h:380
@ PASS_RENDER_TIME
Definition: kernel_types.h:365
@ PASS_ADAPTIVE_AUX_BUFFER
Definition: kernel_types.h:369
@ PASS_CATEGORY_MAIN_END
Definition: kernel_types.h:371
@ PASS_OBJECT_ID
Definition: kernel_types.h:355
@ PASS_AOV_COLOR
Definition: kernel_types.h:367
@ PASS_NONE
Definition: kernel_types.h:348
@ PASS_VOLUME_INDIRECT
Definition: kernel_types.h:389
@ PASS_NORMAL
Definition: kernel_types.h:353
@ PASS_CRYPTOMATTE
Definition: kernel_types.h:366
@ PASS_DIFFUSE_COLOR
Definition: kernel_types.h:381
@ PASS_SAMPLE_COUNT
Definition: kernel_types.h:370
@ PASS_GLOSSY_DIRECT
Definition: kernel_types.h:382
@ PASS_MOTION_WEIGHT
Definition: kernel_types.h:358
@ PASS_AOV_VALUE
Definition: kernel_types.h:368
@ PASS_GLOSSY_COLOR
Definition: kernel_types.h:384
@ PASS_SHADOW
Definition: kernel_types.h:377
@ PASS_GLOSSY_INDIRECT
Definition: kernel_types.h:383
@ PASS_BAKE_DIFFERENTIAL
Definition: kernel_types.h:394
@ PASS_LIGHT
Definition: kernel_types.h:378
@ PASS_BAKE_PRIMITIVE
Definition: kernel_types.h:393
@ PASS_CATEGORY_LIGHT_END
Definition: kernel_types.h:391
@ DENOISING_PASS_SIZE_CLEAN
Definition: kernel_types.h:430
@ DENOISING_PASS_SIZE_BASE
Definition: kernel_types.h:429
@ DENOISING_PASS_SIZE_PREFILTERED
Definition: kernel_types.h:431
#define B
static unsigned a[3]
Definition: RandGen.cpp:92
#define SOCKET_FLOAT(name, ui_name, default_value,...)
Definition: node_type.h:204
#define SOCKET_INT(name, ui_name, default_value,...)
Definition: node_type.h:200
#define SOCKET_BOOLEAN(name, ui_name, default_value,...)
Definition: node_type.h:198
#define SOCKET_STRING(name, ui_name, default_value,...)
Definition: node_type.h:216
#define SOCKET_ENUM(name, ui_name, values, default_value,...)
Definition: node_type.h:220
#define min(a, b)
Definition: sort.c:51
int pass_bake_primitive
int pass_transmission_color
float mist_falloff
int pass_sample_count
int cryptomatte_depth
int pass_glossy_color
int pass_motion_weight
int pass_adaptive_aux_buffer
int pass_transmission_indirect
float mist_start
int pass_volume_indirect
int pass_aov_value
int filter_table_offset
int pass_material_id
int pass_denoising_data
int pass_transmission_direct
int display_pass_components
int pass_denoising_clean
int pass_aov_color_num
int pass_diffuse_direct
int pass_bake_differential
int pass_aov_color
int denoising_flags
int pass_cryptomatte
int pass_volume_direct
int use_display_exposure
int pass_diffuse_color
int light_pass_flag
float pass_alpha_threshold
int pass_background
int pass_glossy_indirect
int pass_object_id
int pass_diffuse_indirect
int display_divide_pass_stride
float exposure
float mist_inv_depth
int display_pass_stride
int pass_glossy_direct
int use_light_pass
int use_display_pass_alpha
int cryptomatte_passes
int pass_aov_value_num
void insert(const char *x, int y)
Definition: node_enum.h:33
static NodeType * add(const char *name, CreateFunc create, Type type=NONE, const NodeType *base=NULL)
Definition: node.h:98
bool is_modified()
Definition: node.cpp:781
ustring name
Definition: node.h:174
vector< Shader * > shaders
Definition: scene.h:236
LookupTables * lookup_tables
Definition: scene.h:228
vector< Pass > passes
Definition: scene.h:239
MotionType need_motion()
Definition: scene.cpp:358
@ MOTION_PASS
Definition: scene.h:280
Integrator * integrator
Definition: scene.h:231
SceneUpdateStats * update_stats
Definition: scene.h:270
GeometryManager * geometry_manager
Definition: scene.h:246
@ TABLE_OFFSET_INVALID
Definition: tables.h:30
#define M_2PI_F
Definition: util_math.h:69
void util_cdf_inverted(const int resolution, const float from, const float to, Functor functor, const bool make_symmetric, vector< float > &inv_cdf)
Definition: util_math_cdf.h:57
ccl_device_inline size_t align_up(size_t offset, size_t alignment)
Definition: util_types.h:65