From 635c2591ffbb602ebf03ebc5ac2ad2ffd9674db1 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 28 Jul 2023 17:33:39 +0200 Subject: [PATCH] Fix #109683: Cycles AOV render without surface output missing attributes --- intern/cycles/scene/shader.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/intern/cycles/scene/shader.cpp b/intern/cycles/scene/shader.cpp index 789dfbd9d66..9c44ff5acc5 100644 --- a/intern/cycles/scene/shader.cpp +++ b/intern/cycles/scene/shader.cpp @@ -339,6 +339,18 @@ void Shader::tag_update(Scene *scene) has_volume = has_volume || output->input("Volume")->link; has_displacement = has_displacement || output->input("Displacement")->link; + if (!has_surface) { + foreach (ShaderNode *node, graph->nodes) { + if (node->special_type == SHADER_SPECIAL_TYPE_OUTPUT_AOV) { + foreach (const ShaderInput *in, node->inputs) { + if (in->link) { + has_surface = true; + } + } + } + } + } + /* get requested attributes. this could be optimized by pruning unused * nodes here already, but that's the job of the shader manager currently, * and may not be so great for interactive rendering where you temporarily @@ -347,8 +359,9 @@ void Shader::tag_update(Scene *scene) AttributeRequestSet prev_attributes = attributes; attributes.clear(); - foreach (ShaderNode *node, graph->nodes) + foreach (ShaderNode *node, graph->nodes) { node->attributes(this, &attributes); + } if (has_displacement) { if (displacement_method == DISPLACE_BOTH) {