diff options
author | Lukas Stockner <lukasstockner97> | 2019-12-04 21:57:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-12-10 22:44:46 +0300 |
commit | e760972221e68d3c81f2ee3687cc71836dde8ae9 (patch) | |
tree | b1a2efbb17c05a429e4509d336a1eb14c73cfb8c /intern/cycles/render/buffers.cpp | |
parent | 35b5888b157d05d378df3acc899d28856a9eb9a4 (diff) |
Cycles: support for custom shader AOVs
Custom render passes are added in the Shader AOVs panel in the view layer
settings, with a name and data type. In shader nodes, an AOV Output node
is then used to output either a value or color to the pass.
Arbitrary names can be used for these passes, as long as they don't conflict
with built-in passes that are enabled. The AOV Output node can be used in both
material and world shader nodes.
Implemented by Lukas, with tweaks by Brecht.
Differential Revision: https://developer.blender.org/D4837
Diffstat (limited to 'intern/cycles/render/buffers.cpp')
-rw-r--r-- | intern/cycles/render/buffers.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 49e15d9eaf1..fe8606e1939 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -234,7 +234,7 @@ bool RenderBuffers::get_denoising_pass_rect( } bool RenderBuffers::get_pass_rect( - PassType type, float exposure, int sample, int components, float *pixels, const string &name) + const string &name, float exposure, int sample, int components, float *pixels) { if (buffer.data() == NULL) { return false; @@ -245,18 +245,14 @@ bool RenderBuffers::get_pass_rect( for (size_t j = 0; j < params.passes.size(); j++) { Pass &pass = params.passes[j]; - if (pass.type != type) { + /* Pass is identified by both type and name, multiple of the same type + * may exist with a different name. */ + if (pass.name != name) { pass_offset += pass.components; continue; } - /* Tell Cryptomatte passes apart by their name. */ - if (pass.type == PASS_CRYPTOMATTE) { - if (pass.name != name) { - pass_offset += pass.components; - continue; - } - } + PassType type = pass.type; float *in = buffer.data() + pass_offset; int pass_stride = params.get_passes_size(); |