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
This commit is contained in:
Lukas Stockner
2019-12-04 19:57:28 +01:00
committed by Brecht Van Lommel
parent 35b5888b15
commit e760972221
46 changed files with 722 additions and 195 deletions

View File

@@ -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();