[Bf-blender-cvs] [43a124bc1c4] blender-v3.3-release: Fix T99179: holdout does not affect transparency without transparent background

Brecht Van Lommel noreply at git.blender.org
Fri Aug 5 19:41:33 CEST 2022


Commit: 43a124bc1c4a2e096a6a81224fc318ac8f9180a4
Author: Brecht Van Lommel
Date:   Fri Aug 5 15:12:43 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB43a124bc1c4a2e096a6a81224fc318ac8f9180a4

Fix T99179: holdout does not affect transparency without transparent background

This was by design, but maybe not so useful in practice. It's always possible to
set alpha to 1 in compositing if needed.

===================================================================

M	intern/cycles/blender/display_driver.cpp
M	intern/cycles/kernel/integrator/shade_surface.h

===================================================================

diff --git a/intern/cycles/blender/display_driver.cpp b/intern/cycles/blender/display_driver.cpp
index a1bc064be68..61cd88fb433 100644
--- a/intern/cycles/blender/display_driver.cpp
+++ b/intern/cycles/blender/display_driver.cpp
@@ -913,8 +913,6 @@ void BlenderDisplayDriver::flush()
 void BlenderDisplayDriver::draw(const Params &params)
 {
   /* See do_update_begin() for why no locking is required here. */
-  const bool transparent = true;  // TODO(sergey): Derive this from Film.
-
   if (use_gl_context_) {
     gl_context_mutex_.lock();
   }
@@ -935,10 +933,8 @@ void BlenderDisplayDriver::draw(const Params &params)
     glWaitSync((GLsync)gl_upload_sync_, 0, GL_TIMEOUT_IGNORED);
   }
 
-  if (transparent) {
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-  }
+  glEnable(GL_BLEND);
+  glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
 
   glActiveTexture(GL_TEXTURE0);
 
@@ -975,9 +971,7 @@ void BlenderDisplayDriver::draw(const Params &params)
 
   glDeleteVertexArrays(1, &vertex_array_object);
 
-  if (transparent) {
-    glDisable(GL_BLEND);
-  }
+  glDisable(GL_BLEND);
 
   gl_render_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
   glFlush();
diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h
index 1514b3956ad..70b20a93b6a 100644
--- a/intern/cycles/kernel/integrator/shade_surface.h
+++ b/intern/cycles/kernel/integrator/shade_surface.h
@@ -43,11 +43,9 @@ ccl_device_forceinline bool integrate_surface_holdout(KernelGlobals kg,
   if (((sd->flag & SD_HOLDOUT) || (sd->object_flag & SD_OBJECT_HOLDOUT_MASK)) &&
       (path_flag & PATH_RAY_TRANSPARENT_BACKGROUND)) {
     const float3 holdout_weight = shader_holdout_apply(kg, sd);
-    if (kernel_data.background.transparent) {
-      const float3 throughput = INTEGRATOR_STATE(state, path, throughput);
-      const float transparent = average(holdout_weight * throughput);
-      kernel_accum_holdout(kg, state, path_flag, transparent, render_buffer);
-    }
+    const float3 throughput = INTEGRATOR_STATE(state, path, throughput);
+    const float transparent = average(holdout_weight * throughput);
+    kernel_accum_holdout(kg, state, path_flag, transparent, render_buffer);
     if (isequal(holdout_weight, one_float3())) {
       return false;
     }



More information about the Bf-blender-cvs mailing list