From 50cabead7f6c3f41df9d8ce839cd75c54fb10877 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 18 Oct 2023 15:39:38 +0200 Subject: [PATCH] Fix #113871: Cycles shader with volume shader and AOV output renders black --- intern/cycles/scene/shader.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/intern/cycles/scene/shader.cpp b/intern/cycles/scene/shader.cpp index 2d9561fe0ab..c56eace8217 100644 --- a/intern/cycles/scene/shader.cpp +++ b/intern/cycles/scene/shader.cpp @@ -348,13 +348,22 @@ void Shader::tag_update(Scene *scene) has_displacement = has_displacement || output->input("Displacement")->link; if (!has_surface) { + /* If we need to output surface AOVs, add a Transparent BSDF so that the + * surface shader runs. */ foreach (ShaderNode *node, graph->nodes) { if (node->special_type == SHADER_SPECIAL_TYPE_OUTPUT_AOV) { foreach (const ShaderInput *in, node->inputs) { if (in->link) { + TransparentBsdfNode *transparent = graph->create_node(); + graph->add(transparent); + graph->connect(transparent->output("BSDF"), output->input("Surface")); has_surface = true; + break; } } + if (has_surface) { + break; + } } } }