[Bf-blender-cvs] [dbda302d135] cycles-x: Cycles X: restore shadow pass
Brecht Van Lommel
noreply at git.blender.org
Wed Jul 14 17:50:46 CEST 2021
Commit: dbda302d13529566de6889845ea3d0c9c84b6831
Author: Brecht Van Lommel
Date: Fri Jul 9 17:02:06 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBdbda302d13529566de6889845ea3d0c9c84b6831
Cycles X: restore shadow pass
Differential Revision: https://developer.blender.org/D11896
===================================================================
M intern/cycles/blender/addon/properties.py
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/integrator/integrator_shade_surface.h
M intern/cycles/kernel/integrator/integrator_shade_volume.h
M intern/cycles/kernel/integrator/integrator_state_template.h
M intern/cycles/kernel/kernel_accumulate.h
M intern/cycles/kernel/kernel_film.h
M intern/cycles/kernel/kernel_types.h
M intern/cycles/render/film.cpp
M intern/cycles/render/light.cpp
M intern/cycles/render/pass.cpp
===================================================================
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 96d0569bd0d..1df57e5bef2 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -132,6 +132,7 @@ enum_view3d_shading_render_pass = (
('EMISSION', "Emission", "Show the Emission render pass"),
('BACKGROUND', "Background", "Show the Background render pass"),
('AO', "Ambient Occlusion", "Show the Ambient Occlusion render pass"),
+ ('SHADOW', "Shadow", "Show the Shadow render pass"),
('SHADOW_CATCHER', "Shadow Catcher", "Show the Shadow Catcher render pass"),
('', "Light", ""),
diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp
index 00f0302838a..cc767523b4f 100644
--- a/intern/cycles/integrator/pass_accessor.cpp
+++ b/intern/cycles/integrator/pass_accessor.cpp
@@ -193,9 +193,6 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
/* Denoised passes store their final pixels, no need in special calculation. */
get_pass_float3(render_buffers, buffer_params, destination);
}
- else if (type == PASS_SHADOW) {
- get_pass_shadow(render_buffers, buffer_params, destination);
- }
else if (pass_info.divide_type != PASS_NONE) {
/* RGB lighting passes that need to divide out color */
get_pass_divide_even_color(render_buffers, buffer_params, destination);
@@ -221,9 +218,6 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
/* Denoised passes store their final pixels, no need in special calculation. */
get_pass_float4(render_buffers, buffer_params, destination);
}
- else if (type == PASS_SHADOW) {
- get_pass_shadow(render_buffers, buffer_params, destination);
- }
else if (type == PASS_MOTION) {
get_pass_motion(render_buffers, buffer_params, destination);
}
diff --git a/intern/cycles/integrator/pass_accessor.h b/intern/cycles/integrator/pass_accessor.h
index 88f605830dd..9aa4d995c41 100644
--- a/intern/cycles/integrator/pass_accessor.h
+++ b/intern/cycles/integrator/pass_accessor.h
@@ -142,9 +142,6 @@ class PassAccessor {
DECLARE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow)
DECLARE_PASS_ACCESSOR(float4)
- /* Float3 or Float4 passes. */
- DECLARE_PASS_ACCESSOR(shadow)
-
#undef DECLARE_PASS_ACCESSOR
PassAccessInfo pass_access_info_;
diff --git a/intern/cycles/integrator/pass_accessor_cpu.cpp b/intern/cycles/integrator/pass_accessor_cpu.cpp
index af6890f304b..2966c28c379 100644
--- a/intern/cycles/integrator/pass_accessor_cpu.cpp
+++ b/intern/cycles/integrator/pass_accessor_cpu.cpp
@@ -170,9 +170,6 @@ DEFINE_PASS_ACCESSOR(shadow_catcher)
DEFINE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow)
DEFINE_PASS_ACCESSOR(float4)
-/* Float3 or Float4 passes. */
-DEFINE_PASS_ACCESSOR(shadow)
-
#undef DEFINE_PASS_ACCESSOR
CCL_NAMESPACE_END
diff --git a/intern/cycles/integrator/pass_accessor_cpu.h b/intern/cycles/integrator/pass_accessor_cpu.h
index 905c7ac9980..f3cc050aa08 100644
--- a/intern/cycles/integrator/pass_accessor_cpu.h
+++ b/intern/cycles/integrator/pass_accessor_cpu.h
@@ -70,9 +70,6 @@ class PassAccessorCPU : public PassAccessor {
DECLARE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow)
DECLARE_PASS_ACCESSOR(float4)
- /* Float3 or Float4 passes. */
- DECLARE_PASS_ACCESSOR(shadow)
-
#undef DECLARE_PASS_ACCESSOR
};
diff --git a/intern/cycles/integrator/pass_accessor_gpu.cpp b/intern/cycles/integrator/pass_accessor_gpu.cpp
index a4a3d78ffed..19f91044b38 100644
--- a/intern/cycles/integrator/pass_accessor_gpu.cpp
+++ b/intern/cycles/integrator/pass_accessor_gpu.cpp
@@ -103,9 +103,6 @@ DEFINE_PASS_ACCESSOR(shadow_catcher, SHADOW_CATCHER);
DEFINE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow, SHADOW_CATCHER_MATTE_WITH_SHADOW);
DEFINE_PASS_ACCESSOR(float4, FLOAT4);
-/* Float3 or Float4 passes. */
-DEFINE_PASS_ACCESSOR(shadow, SHADOW);
-
#undef DEFINE_PASS_ACCESSOR
CCL_NAMESPACE_END
diff --git a/intern/cycles/integrator/pass_accessor_gpu.h b/intern/cycles/integrator/pass_accessor_gpu.h
index 7eb16936f0c..aaf4b8321c1 100644
--- a/intern/cycles/integrator/pass_accessor_gpu.h
+++ b/intern/cycles/integrator/pass_accessor_gpu.h
@@ -59,9 +59,6 @@ class PassAccessorGPU : public PassAccessor {
DECLARE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow);
DECLARE_PASS_ACCESSOR(float4);
- /* Float3 or Float4 passes. */
- DECLARE_PASS_ACCESSOR(shadow);
-
#undef DECLARE_PASS_ACCESSOR
DeviceQueue *queue_;
diff --git a/intern/cycles/kernel/device/cuda/kernel.cu b/intern/cycles/kernel/device/cuda/kernel.cu
index fffbe663d72..14da02cc809 100644
--- a/intern/cycles/kernel/device/cuda/kernel.cu
+++ b/intern/cycles/kernel/device/cuda/kernel.cu
@@ -624,8 +624,6 @@ KERNEL_FILM_CONVERT_DEFINE(shadow_catcher, rgba)
KERNEL_FILM_CONVERT_DEFINE(shadow_catcher_matte_with_shadow, rgba)
KERNEL_FILM_CONVERT_DEFINE(float4, rgba)
-KERNEL_FILM_CONVERT_DEFINE(shadow, rgb)
-
# undef KERNEL_FILM_CONVERT_DEFINE
# undef KERNEL_FILM_CONVERT_HALF_RGBA_DEFINE
# undef KERNEL_FILM_CONVERT_PROC
diff --git a/intern/cycles/kernel/integrator/integrator_shade_surface.h b/intern/cycles/kernel/integrator/integrator_shade_surface.h
index eefbcad87de..aafb6f3a072 100644
--- a/intern/cycles/kernel/integrator/integrator_shade_surface.h
+++ b/intern/cycles/kernel/integrator/integrator_shade_surface.h
@@ -190,6 +190,10 @@ ccl_device_forceinline void integrate_surface_direct_light(INTEGRATOR_STATE_ARGS
INTEGRATOR_STATE_WRITE(shadow_path, transparent_bounce) = transparent_bounce;
INTEGRATOR_STATE_WRITE(shadow_path, throughput) = throughput;
+ if (kernel_data.kernel_features & KERNEL_FEATURE_SHADOW_PASS) {
+ INTEGRATOR_STATE_WRITE(shadow_path, unshadowed_throughput) = throughput;
+ }
+
/* Branch off shadow kernel. */
INTEGRATOR_SHADOW_PATH_INIT(DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW);
}
diff --git a/intern/cycles/kernel/integrator/integrator_shade_volume.h b/intern/cycles/kernel/integrator/integrator_shade_volume.h
index c95ac43168c..d01f3b6cc71 100644
--- a/intern/cycles/kernel/integrator/integrator_shade_volume.h
+++ b/intern/cycles/kernel/integrator/integrator_shade_volume.h
@@ -598,6 +598,10 @@ ccl_device_forceinline void integrate_volume_direct_light(INTEGRATOR_STATE_ARGS,
INTEGRATOR_STATE_WRITE(shadow_path, transparent_bounce) = transparent_bounce;
INTEGRATOR_STATE_WRITE(shadow_path, throughput) = throughput;
+ if (kernel_data.kernel_features & KERNEL_FEATURE_SHADOW_PASS) {
+ INTEGRATOR_STATE_WRITE(shadow_path, unshadowed_throughput) = throughput;
+ }
+
integrator_state_copy_volume_stack_to_shadow(INTEGRATOR_STATE_PASS);
/* Branch off shadow kernel. */
diff --git a/intern/cycles/kernel/integrator/integrator_state_template.h b/intern/cycles/kernel/integrator/integrator_state_template.h
index 36a42d30dea..13f565b29de 100644
--- a/intern/cycles/kernel/integrator/integrator_state_template.h
+++ b/intern/cycles/kernel/integrator/integrator_state_template.h
@@ -119,6 +119,8 @@ KERNEL_STRUCT_MEMBER(shadow_path, uint32_t, queued_kernel, KERNEL_FEATURE_PATH_T
KERNEL_STRUCT_MEMBER(shadow_path, uint32_t, flag, KERNEL_FEATURE_PATH_TRACING)
/* Throughput. */
KERNEL_STRUCT_MEMBER(shadow_path, float3, throughput, KERNEL_FEATURE_PATH_TRACING)
+/* Throughput for shadow pass. */
+KERNEL_STRUCT_MEMBER(shadow_path, float3, unshadowed_throughput, KERNEL_FEATURE_SHADOW_PASS)
/* Ratio of throughput to distinguish diffuse and glossy render passes. */
KERNEL_STRUCT_MEMBER(shadow_path, float3, diffuse_glossy_ratio, KERNEL_FEATURE_LIGHT_PASSES)
/* Number of intersections found by ray-tracing. */
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index f5850ec9258..7417ad126d3 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -116,193 +116,6 @@ ccl_device_forceinline void kernel_accum_clamp(const KernelGlobals *kg, float3 *
#endif
}
-/* --------------------------------------------------------------------
- * Legacy functions.
- *
- * TODO: Seems to be mainly related to shadow catcher, which is about to have new implementation.
- * Some other code is related to clamping, which is done in `kernel_accum_clamp()`. Port remaining
- * parts over, remove legacy code.
- */
-
-#if 0
-ccl_device_inline void path_radiance_accum_light(const KernelGlobals *kg,
- PathRadiance *L,
- ccl_addr_space PathState *state,
- float3 throughput,
- BsdfEval *bsdf_eval,
- float3 shadow,
- float shadow_fac,
- bool is_lamp)
-{
-# ifdef __SHADOW_TRICKS__
- if (state->flag & PATH_RAY_STORE_SHADOW_INFO) {
- float3 light = throughput * bsdf_eval->sum_no_mis;
- L->path_total += light;
- L->path_total_shaded += shadow * light;
-
- if (state->flag & PATH_RAY_SHADOW_CATCHER) {
- return;
- }
- }
-# endif
-}
-
-ccl_device_inline void path_radiance_accum_total_light(PathRadiance *L,
- ccl_addr_space PathState *state,
- float3 throughput,
- const BsdfEval *bsdf_eval)
-{
-# ifdef __SHADOW_TRICKS__
- if (state->flag & PATH_RAY_STORE_SHADOW_INFO) {
- L->path_total += throughput * bsdf_eval->sum_no_mis;
- }
-# else
- (void)L;
- (void)state;
- (void)throughput;
- (void)bsdf_eval;
-# endif
-}
-
-ccl_device_inline void path_radiance_accum_background(const KernelGlobals *kg,
- PathRadiance *L,
- ccl_addr_space PathState *state,
- float3 throughput,
- float3 value)
-{
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list