From 13ec512f4b9a9232d04a8995fab1837798ef4c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Mon, 16 Nov 2020 17:34:13 +0100 Subject: Fix T81983: volume tiles missing in Cycles renders The OpenVDB data structure can store voxel data in leaf nodes or tiles when all the nodes in a given region have a constant value. However, Cycles is using the leaf nodes to generate the acceleration structure for computing volume intersections which did not include constant tiles. To fix this, we simply voxelize all the active tiles prior to generating the volume bounding mesh. As we are using a MaskGrid, this will not allocate actual voxel buffers for each leaf, so the memory usage will be kept low. Differential Revision: https://developer.blender.org/D9557 Reviewed by: brecht, JacquesLucke --- intern/cycles/render/volume.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'intern') diff --git a/intern/cycles/render/volume.cpp b/intern/cycles/render/volume.cpp index 9e633b27cc9..ebb9752756e 100644 --- a/intern/cycles/render/volume.cpp +++ b/intern/cycles/render/volume.cpp @@ -289,6 +289,10 @@ void VolumeMeshBuilder::create_mesh(vector &vertices, vector vertices_is; vector quads; + /* make sure we only have leaf nodes in the tree, as tiles are not handled by + * this algorithm */ + topology_grid->tree().voxelizeActiveTiles(); + generate_vertices_and_quads(vertices_is, quads); convert_object_space(vertices_is, vertices, face_overlap_avoidance); -- cgit v1.2.3 From 457d537fe4f33cfb16e5672404aa9f87797d9d23 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 16 Nov 2020 19:28:58 +0100 Subject: Fix T82673: Cycles crash with zero emission strength and linked emission color --- intern/cycles/render/nodes.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'intern') diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index fa6096ff39b..5e21ad15cc8 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -2785,7 +2785,7 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph) ShaderInput *emission_strength_in = input("Emission Strength"); if ((emission_in->link || emission != make_float3(0.0f, 0.0f, 0.0f)) && (emission_strength_in->link || emission_strength != 0.0f)) { - /* Create add closure and emission. */ + /* Create add closure and emission, and relink inputs. */ AddClosureNode *add = graph->create_node(); EmissionNode *emission_node = graph->create_node(); ShaderOutput *new_out = add->output("Closure"); @@ -2801,6 +2801,16 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph) principled_out = new_out; } + else { + /* Disconnect unused links if the other value is zero, required before + * we remove the input from the node entirely. */ + if (emission_in->link) { + emission_in->disconnect(); + } + if (emission_strength_in->link) { + emission_strength_in->disconnect(); + } + } ShaderInput *alpha_in = input("Alpha"); if (alpha_in->link || alpha != 1.0f) { @@ -2818,6 +2828,7 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph) } remove_input(emission_in); + remove_input(emission_strength_in); remove_input(alpha_in); } -- cgit v1.2.3