Blender  V3.3
film.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __FILM_H__
5 #define __FILM_H__
6 
7 #include "scene/pass.h"
8 #include "util/string.h"
9 #include "util/vector.h"
10 
11 #include "kernel/types.h"
12 
13 #include "graph/node.h"
14 
16 
17 class Device;
18 class DeviceScene;
19 class Scene;
20 
21 typedef enum FilterType {
25 
28 
29 class Film : public Node {
30  public:
32 
33  NODE_SOCKET_API(float, exposure)
34  NODE_SOCKET_API(float, pass_alpha_threshold)
35 
36  NODE_SOCKET_API(PassType, display_pass)
37  NODE_SOCKET_API(bool, show_active_pixels)
38 
39  NODE_SOCKET_API(FilterType, filter_type)
40  NODE_SOCKET_API(float, filter_width)
41 
42  NODE_SOCKET_API(float, mist_start)
43  NODE_SOCKET_API(float, mist_depth)
44  NODE_SOCKET_API(float, mist_falloff)
45 
46  NODE_SOCKET_API(CryptomatteType, cryptomatte_passes)
47  NODE_SOCKET_API(int, cryptomatte_depth)
48 
49  /* Approximate shadow catcher pass into its matte pass, so that both artificial objects and
50  * shadows can be alpha-overed onto a backdrop. */
51  NODE_SOCKET_API(bool, use_approximate_shadow_catcher)
52 
53  private:
54  size_t filter_table_offset_;
55  bool prev_have_uv_pass = false;
56  bool prev_have_motion_pass = false;
57  bool prev_have_ao_pass = false;
58 
59  public:
60  Film();
61  ~Film();
62 
63  /* add default passes to scene */
64  static void add_default(Scene *scene);
65 
66  void device_update(Device *device, DeviceScene *dscene, Scene *scene);
67  void device_free(Device *device, DeviceScene *dscene, Scene *scene);
68 
69  int get_aov_offset(Scene *scene, string name, bool &is_color);
70 
72 
73  /* Update passes so that they contain all passes required for the configured functionality.
74  *
75  * If `add_sample_count_pass` is true then the SAMPLE_COUNT pass is ensured to be added. */
76  void update_passes(Scene *scene, bool add_sample_count_pass);
77 
78  uint get_kernel_features(const Scene *scene) const;
79 
80  private:
81  void add_auto_pass(Scene *scene, PassType type, const char *name = nullptr);
82  void add_auto_pass(Scene *scene, PassType type, PassMode mode, const char *name = nullptr);
83  void remove_auto_passes(Scene *scene);
84  void finalize_passes(Scene *scene, const bool use_denoise);
85 };
86 
88 
89 #endif /* __FILM_H__ */
unsigned int uint
Definition: BLI_sys_types.h:67
Definition: film.h:29
int get_aov_offset(Scene *scene, string name, bool &is_color)
Definition: film.cpp:415
uint get_kernel_features(const Scene *scene) const
Definition: film.cpp:696
~Film()
Definition: film.cpp:130
static void add_default(Scene *scene)
Definition: film.cpp:134
void update_passes(Scene *scene, bool add_sample_count_pass)
Definition: film.cpp:461
void device_free(Device *device, DeviceScene *dscene, Scene *scene)
Definition: film.cpp:410
void device_update(Device *device, DeviceScene *dscene, Scene *scene)
Definition: film.cpp:140
Film()
Definition: film.cpp:126
bool update_lightgroups(Scene *scene)
Definition: film.cpp:441
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
Scene scene
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
@ FILTER_GAUSSIAN
Definition: film.h:23
#define NODE_SOCKET_API(type_, name)
Definition: graph/node.h:54
CryptomatteType
Definition: kernel/types.h:407
PassType
Definition: kernel/types.h:334
#define NODE_DECLARE
Definition: node_type.h:135
PassMode
Definition: pass.h:19
const NodeType * type
Definition: graph/node.h:175
ustring name
Definition: graph/node.h:174