Blender V4.3
pass.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#include <iosfwd>
8
9#include "util/string.h"
10#include "util/vector.h"
11
12#include "kernel/types.h"
13
14#include "graph/node.h"
15
17
18const char *pass_type_as_string(const PassType type);
19
20enum class PassMode {
21 NOISY,
23};
24const char *pass_mode_as_string(PassMode mode);
25std::ostream &operator<<(std::ostream &os, PassMode mode);
26
27struct PassInfo {
29 bool use_filter = false;
30 bool use_exposure = false;
31 bool is_written = true;
35
36 /* Pass access for read can not happen directly and needs some sort of compositing (for example,
37 * light passes due to divide_type, or shadow catcher pass. */
38 bool use_compositing = false;
39
40 /* Used to disable albedo pass for denoising.
41 * Light and shadow catcher passes should not have discontinuity in the denoised result based on
42 * the underlying albedo. */
44
45 /* Pass supports denoising. */
46 bool support_denoise = false;
47};
48
49class Pass : public Node {
50 public:
52
55 NODE_SOCKET_API(ustring, name)
56 NODE_SOCKET_API(bool, include_albedo)
57 NODE_SOCKET_API(ustring, lightgroup)
58
59 Pass();
60
61 PassInfo get_info() const;
62
63 /* The pass is written by the render pipeline (kernel or denoiser). If the pass is written it
64 * will have pixels allocated in a RenderBuffer. Passes which are not written do not have their
65 * pixels allocated to save memory. */
66 bool is_written() const;
67
68 protected:
69 /* The has been created automatically as a requirement to various rendering functionality (such
70 * as adaptive sampling). */
72
73 public:
74 static const NodeEnum *get_type_enum();
75 static const NodeEnum *get_mode_enum();
76
77 static PassInfo get_info(PassType type,
78 const bool include_albedo = false,
79 const bool is_lightgroup = false);
80
81 static bool contains(const vector<Pass *> &passes, PassType type);
82
83 /* Returns nullptr if there is no pass with the given name or type+mode. */
84 static const Pass *find(const vector<Pass *> &passes, const string &name);
85 static const Pass *find(const vector<Pass *> &passes,
86 PassType type,
88 const ustring &lightgroup = ustring());
89
90 /* Returns PASS_UNUSED if there is no corresponding pass. */
91 static int get_offset(const vector<Pass *> &passes, const Pass *pass);
92
93 friend class Film;
94};
95
96std::ostream &operator<<(std::ostream &os, const Pass &pass);
97
Definition film.h:30
Definition pass.h:49
PassInfo get_info() const
Definition pass.cpp:141
static const NodeEnum * get_type_enum()
Definition pass.cpp:45
NODE_DECLARE Pass()
Definition pass.cpp:139
bool is_written() const
Definition pass.cpp:146
static const NodeEnum * get_mode_enum()
Definition pass.cpp:111
bool is_auto_
Definition pass.h:71
static const Pass * find(const vector< Pass * > &passes, const string &name)
Definition pass.cpp:381
static bool contains(const vector< Pass * > &passes, PassType type)
Definition pass.cpp:368
static int get_offset(const vector< Pass * > &passes, const Pass *pass)
Definition pass.cpp:409
#define CCL_NAMESPACE_END
#define NODE_SOCKET_API(type_, name)
Definition graph/node.h:55
PassType
@ PASS_NONE
#define NODE_DECLARE
Definition node_type.h:142
const char * pass_mode_as_string(PassMode mode)
Definition pass.cpp:26
PassMode
Definition pass.h:20
CCL_NAMESPACE_BEGIN const char * pass_type_as_string(const PassType type)
Definition pass.cpp:12
std::ostream & operator<<(std::ostream &os, PassMode mode)
Definition pass.cpp:39
PassType direct_type
Definition pass.h:33
bool use_compositing
Definition pass.h:38
bool use_denoising_albedo
Definition pass.h:43
int num_components
Definition pass.h:28
bool support_denoise
Definition pass.h:46
bool use_filter
Definition pass.h:29
PassType divide_type
Definition pass.h:32
bool use_exposure
Definition pass.h:30
PassType indirect_type
Definition pass.h:34
bool is_written
Definition pass.h:31