[Bf-blender-cvs] [3d933091818] cycles-x: Fix various issue with render passes
Brecht Van Lommel
noreply at git.blender.org
Thu Jul 22 20:16:51 CEST 2021
Commit: 3d93309181810463b3a5721d368ae6c752f2f1aa
Author: Brecht Van Lommel
Date: Thu Jul 22 18:36:04 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB3d93309181810463b3a5721d368ae6c752f2f1aa
Fix various issue with render passes
* Color AOV wrong alpha
* Value AOV not working at all
* Remove unused Denoising Depth pass
===================================================================
M intern/cycles/blender/addon/engine.py
M intern/cycles/device/device_kernel.cpp
M intern/cycles/integrator/pass_accessor.cpp
M intern/cycles/integrator/pass_accessor.h
M intern/cycles/integrator/pass_accessor_cpu.cpp
M intern/cycles/integrator/pass_accessor_cpu.h
M intern/cycles/integrator/pass_accessor_gpu.cpp
M intern/cycles/integrator/pass_accessor_gpu.h
M intern/cycles/kernel/device/cuda/kernel.cu
M intern/cycles/kernel/kernel_film.h
M intern/cycles/kernel/kernel_types.h
M intern/cycles/kernel/svm/svm_aov.h
===================================================================
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index b750ae5db6b..3c9dbe1d24a 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -238,7 +238,6 @@ def list_render_passes(scene, srl):
if crl.denoising_store_passes:
yield ("Denoising Normal", "XYZ", 'VECTOR')
yield ("Denoising Albedo", "RGB", 'COLOR')
- yield ("Denoising Depth", "Z", 'VALUE')
# Custom AOV passes.
for aov in srl.aovs:
diff --git a/intern/cycles/device/device_kernel.cpp b/intern/cycles/device/device_kernel.cpp
index 9689e7a30ca..ee3cfdb27dd 100644
--- a/intern/cycles/device/device_kernel.cpp
+++ b/intern/cycles/device/device_kernel.cpp
@@ -94,6 +94,7 @@ const char *device_kernel_as_string(DeviceKernel kernel)
FILM_CONVERT_KERNEL_AS_STRING(SHADOW_CATCHER, shadow_catcher)
FILM_CONVERT_KERNEL_AS_STRING(SHADOW_CATCHER_MATTE_WITH_SHADOW,
shadow_catcher_matte_with_shadow)
+ FILM_CONVERT_KERNEL_AS_STRING(COMBINED, combined)
FILM_CONVERT_KERNEL_AS_STRING(FLOAT4, float4)
#undef FILM_CONVERT_KERNEL_AS_STRING
diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp
index c7c5e7ad303..6ff8585007c 100644
--- a/intern/cycles/integrator/pass_accessor.cpp
+++ b/intern/cycles/integrator/pass_accessor.cpp
@@ -221,7 +221,12 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
}
else if (mode == PassMode::DENOISED) {
/* Denoised passes store their final pixels, no need in special calculation. */
- get_pass_float4(render_buffers, buffer_params, destination);
+ if (type == PASS_COMBINED) {
+ get_pass_combined(render_buffers, buffer_params, destination);
+ }
+ else {
+ get_pass_float4(render_buffers, buffer_params, destination);
+ }
}
else if (type == PASS_MOTION) {
get_pass_motion(render_buffers, buffer_params, destination);
@@ -232,6 +237,9 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
else if (type == PASS_SHADOW_CATCHER) {
get_pass_shadow_catcher(render_buffers, buffer_params, destination);
}
+ else if (type == PASS_COMBINED) {
+ get_pass_combined(render_buffers, buffer_params, destination);
+ }
else {
get_pass_float4(render_buffers, buffer_params, destination);
}
diff --git a/intern/cycles/integrator/pass_accessor.h b/intern/cycles/integrator/pass_accessor.h
index 6ca7c8d9c05..3a17402bb95 100644
--- a/intern/cycles/integrator/pass_accessor.h
+++ b/intern/cycles/integrator/pass_accessor.h
@@ -143,6 +143,7 @@ class PassAccessor {
DECLARE_PASS_ACCESSOR(cryptomatte)
DECLARE_PASS_ACCESSOR(shadow_catcher)
DECLARE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow)
+ DECLARE_PASS_ACCESSOR(combined)
DECLARE_PASS_ACCESSOR(float4)
#undef DECLARE_PASS_ACCESSOR
diff --git a/intern/cycles/integrator/pass_accessor_cpu.cpp b/intern/cycles/integrator/pass_accessor_cpu.cpp
index 2966c28c379..b81ec79bb91 100644
--- a/intern/cycles/integrator/pass_accessor_cpu.cpp
+++ b/intern/cycles/integrator/pass_accessor_cpu.cpp
@@ -168,6 +168,7 @@ DEFINE_PASS_ACCESSOR(motion)
DEFINE_PASS_ACCESSOR(cryptomatte)
DEFINE_PASS_ACCESSOR(shadow_catcher)
DEFINE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow)
+DEFINE_PASS_ACCESSOR(combined)
DEFINE_PASS_ACCESSOR(float4)
#undef DEFINE_PASS_ACCESSOR
diff --git a/intern/cycles/integrator/pass_accessor_cpu.h b/intern/cycles/integrator/pass_accessor_cpu.h
index f3cc050aa08..4862fee0082 100644
--- a/intern/cycles/integrator/pass_accessor_cpu.h
+++ b/intern/cycles/integrator/pass_accessor_cpu.h
@@ -68,6 +68,7 @@ class PassAccessorCPU : public PassAccessor {
DECLARE_PASS_ACCESSOR(cryptomatte)
DECLARE_PASS_ACCESSOR(shadow_catcher)
DECLARE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow)
+ DECLARE_PASS_ACCESSOR(combined)
DECLARE_PASS_ACCESSOR(float4)
#undef DECLARE_PASS_ACCESSOR
diff --git a/intern/cycles/integrator/pass_accessor_gpu.cpp b/intern/cycles/integrator/pass_accessor_gpu.cpp
index 19f91044b38..13ca783e49e 100644
--- a/intern/cycles/integrator/pass_accessor_gpu.cpp
+++ b/intern/cycles/integrator/pass_accessor_gpu.cpp
@@ -101,6 +101,7 @@ DEFINE_PASS_ACCESSOR(motion, MOTION);
DEFINE_PASS_ACCESSOR(cryptomatte, CRYPTOMATTE);
DEFINE_PASS_ACCESSOR(shadow_catcher, SHADOW_CATCHER);
DEFINE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow, SHADOW_CATCHER_MATTE_WITH_SHADOW);
+DEFINE_PASS_ACCESSOR(combined, COMBINED);
DEFINE_PASS_ACCESSOR(float4, FLOAT4);
#undef DEFINE_PASS_ACCESSOR
diff --git a/intern/cycles/integrator/pass_accessor_gpu.h b/intern/cycles/integrator/pass_accessor_gpu.h
index aaf4b8321c1..719774e7035 100644
--- a/intern/cycles/integrator/pass_accessor_gpu.h
+++ b/intern/cycles/integrator/pass_accessor_gpu.h
@@ -57,6 +57,7 @@ class PassAccessorGPU : public PassAccessor {
DECLARE_PASS_ACCESSOR(cryptomatte);
DECLARE_PASS_ACCESSOR(shadow_catcher);
DECLARE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow);
+ DECLARE_PASS_ACCESSOR(combined);
DECLARE_PASS_ACCESSOR(float4);
#undef DECLARE_PASS_ACCESSOR
diff --git a/intern/cycles/kernel/device/cuda/kernel.cu b/intern/cycles/kernel/device/cuda/kernel.cu
index 0e784a39031..0bf198c991b 100644
--- a/intern/cycles/kernel/device/cuda/kernel.cu
+++ b/intern/cycles/kernel/device/cuda/kernel.cu
@@ -597,6 +597,7 @@ KERNEL_FILM_CONVERT_DEFINE(motion, rgba)
KERNEL_FILM_CONVERT_DEFINE(cryptomatte, rgba)
KERNEL_FILM_CONVERT_DEFINE(shadow_catcher, rgba)
KERNEL_FILM_CONVERT_DEFINE(shadow_catcher_matte_with_shadow, rgba)
+KERNEL_FILM_CONVERT_DEFINE(combined, rgba)
KERNEL_FILM_CONVERT_DEFINE(float4, rgba)
# undef KERNEL_FILM_CONVERT_DEFINE
diff --git a/intern/cycles/kernel/kernel_film.h b/intern/cycles/kernel/kernel_film.h
index 720a08c47d0..ec18a141116 100644
--- a/intern/cycles/kernel/kernel_film.h
+++ b/intern/cycles/kernel/kernel_film.h
@@ -260,14 +260,22 @@ ccl_device_inline void film_get_pass_pixel_float4(const KernelFilmConvert *ccl_r
const float *in = buffer + kfilm_convert->pass_offset;
- /* Note that 3rd channel contains transparency = 1 - alpha at this point. */
const float3 color = make_float3(in[0], in[1], in[2]) * scale_exposure;
- const float transparency = in[3] * scale;
+ const float alpha = in[3] * scale;
pixel[0] = color.x;
pixel[1] = color.y;
pixel[2] = color.z;
- pixel[3] = film_transparency_to_alpha(transparency);
+ pixel[3] = alpha;
+}
+ccl_device_inline void film_get_pass_pixel_combined(const KernelFilmConvert *ccl_restrict
+ kfilm_convert,
+ ccl_global const float *ccl_restrict buffer,
+ float *ccl_restrict pixel)
+{
+ /* 3rd channel contains transparency = 1 - alpha for the combined pass. */
+ film_get_pass_pixel_float4(kfilm_convert, buffer, pixel);
+ pixel[3] = film_transparency_to_alpha(pixel[3]);
}
/* --------------------------------------------------------------------
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 67bde062c87..cba5744d83e 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -1415,6 +1415,7 @@ typedef enum DeviceKernel {
DECLARE_FILM_CONVERT_KERNEL(CRYPTOMATTE),
DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER),
DECLARE_FILM_CONVERT_KERNEL(SHADOW_CATCHER_MATTE_WITH_SHADOW),
+ DECLARE_FILM_CONVERT_KERNEL(COMBINED),
DECLARE_FILM_CONVERT_KERNEL(FLOAT4),
#undef DECLARE_FILM_CONVERT_KERNEL
diff --git a/intern/cycles/kernel/svm/svm_aov.h b/intern/cycles/kernel/svm/svm_aov.h
index 403df254bd9..c4eea0bb1da 100644
--- a/intern/cycles/kernel/svm/svm_aov.h
+++ b/intern/cycles/kernel/svm/svm_aov.h
@@ -57,7 +57,7 @@ ccl_device void svm_node_aov_value(INTEGRATOR_STATE_CONST_ARGS,
kernel_data.film.pass_stride;
ccl_global float *buffer = render_buffer + render_buffer_offset +
(kernel_data.film.pass_aov_value + node.z);
- kernel_write_pass_float(buffer + kernel_data.film.pass_aov_value + node.z, val);
+ kernel_write_pass_float(buffer, val);
}
}
CCL_NAMESPACE_END
More information about the Bf-blender-cvs
mailing list