Commit: 18abc2feaad6ccf162ee4a254405f854f705d101 Author: Brecht Van Lommel Date: Mon Dec 12 17:22:04 2022 +0100 Branches: master https://developer.blender.org/rB18abc2feaad6ccf162ee4a254405f854f705d101
Fix Cycles light tree not working with negative light strength Use absolute value of emission as estimate to make this work. Contributed by Alaska. Differential Revision: https://developer.blender.org/D16718 =================================================================== M intern/cycles/scene/light_tree.cpp M intern/cycles/scene/shader.cpp =================================================================== diff --git a/intern/cycles/scene/light_tree.cpp b/intern/cycles/scene/light_tree.cpp index 9bf4bdca097..f9bd479cf1c 100644 --- a/intern/cycles/scene/light_tree.cpp +++ b/intern/cycles/scene/light_tree.cpp @@ -181,7 +181,9 @@ LightTreePrimitive::LightTreePrimitive(Scene *scene, int prim_id, int object_id) strength *= lamp->get_shader()->emission_estimate; } - energy = average(strength); + /* Use absolute value of energy so lights with negative strength are properly + * supported in the light tree. */ + energy = fabsf(average(strength)); } } diff --git a/intern/cycles/scene/shader.cpp b/intern/cycles/scene/shader.cpp index ca15d0e1c44..09255d7cee4 100644 --- a/intern/cycles/scene/shader.cpp +++ b/intern/cycles/scene/shader.cpp @@ -349,7 +349,7 @@ void Shader::estimate_emission() } ShaderInput *surf = graph->output()->input("Surface"); - emission_estimate = output_estimate_emission(surf->link, emission_is_constant); + emission_estimate = fabs(output_estimate_emission(surf->link, emission_is_constant)); if (is_zero(emission_estimate)) { emission_sampling = EMISSION_SAMPLING_NONE; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs