Fix T87007: Cycles Background not updated if strength is initially null

When the strength is initially set to zero, the shader graph is
optimized out to remove any node which will not be executed because of
this, which removes pretty much every single node, except for the
output. As the graph is empty, the world shader is made invisible to
rays so it is not evaluated in the kernel.

However, when the strength is then modified, the Background is not
updated as the modification happens on the Shader Node and not on the
Background Node, so it is never tagged as modified.

To fix this, we need to tag the Background as modified when its shader
is also modified so the Kernel data is properly updated.

Regression caused by rBbbe6d44928235cd4a5cfbeaf1a1de78ed861bb92.
This commit is contained in:
Kévin Dietrich 2021-03-30 15:40:40 +02:00
parent f1fe42d912
commit 88d94d89fa
Notes: blender-bot 2024-01-16 18:05:25 +01:00
Referenced by issue #87007, World shader does not update when strength is initially zero (Cycles - 2.93 Regression)
1 changed files with 8 additions and 0 deletions

View File

@ -130,6 +130,14 @@ void Background::device_free(Device * /*device*/, DeviceScene * /*dscene*/)
void Background::tag_update(Scene *scene)
{
Shader *bg_shader = get_shader(scene);
if (bg_shader && bg_shader->is_modified()) {
/* Tag as modified to update the KernelBackground visibility information.
* We only tag the use_shader socket as modified as it is related to the shader
* and to avoid doing unnecessary updates anywhere else. */
tag_use_shader_modified();
}
if (ao_factor_is_modified() || use_ao_is_modified()) {
scene->integrator->tag_update(scene, Integrator::BACKGROUND_AO_MODIFIED);
}