diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-09-20 17:16:11 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-19 16:11:09 +0300 |
commit | fd77a28031daff3122ded3a1cb37a7fb44feedf6 (patch) | |
tree | f54967b7f5f1175555aa21d613137fe436d7fc8c /intern/cycles/device | |
parent | d06828f0b8ebb083de59fd2cb8c5f8fe6af1da22 (diff) |
Cycles: bake transparent shadows for hair
These transparent shadows can be expansive to evaluate. Especially on the
GPU they can lead to poor occupancy when only some pixels require many kernel
launches to trace and evaluate many layers of transparency.
Baked transparency allows tracing a single ray in many cases by accumulating
the throughput directly in the intersection program without recording hits
or evaluating shaders. Transparency is baked at curve vertices and
interpolated, for most shaders this will look practically the same as actual
shader evaluation.
Fixes T91428, performance regression with spring demo file due to transparent
hair, and makes it render significantly faster than Blender 2.93.
Differential Revision: https://developer.blender.org/D12880
Diffstat (limited to 'intern/cycles/device')
-rw-r--r-- | intern/cycles/device/cpu/kernel.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/device/cpu/kernel.h | 1 | ||||
-rw-r--r-- | intern/cycles/device/device_kernel.cpp | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/intern/cycles/device/cpu/kernel.cpp b/intern/cycles/device/cpu/kernel.cpp index 91282390e27..bbad2f3147d 100644 --- a/intern/cycles/device/cpu/kernel.cpp +++ b/intern/cycles/device/cpu/kernel.cpp @@ -44,6 +44,7 @@ CPUKernels::CPUKernels() /* Shader evaluation. */ REGISTER_KERNEL(shader_eval_displace), REGISTER_KERNEL(shader_eval_background), + REGISTER_KERNEL(shader_eval_curve_shadow_transparency), /* Adaptive sampling. */ REGISTER_KERNEL(adaptive_sampling_convergence_check), REGISTER_KERNEL(adaptive_sampling_filter_x), diff --git a/intern/cycles/device/cpu/kernel.h b/intern/cycles/device/cpu/kernel.h index 2db09057e44..3787fe37a33 100644 --- a/intern/cycles/device/cpu/kernel.h +++ b/intern/cycles/device/cpu/kernel.h @@ -58,6 +58,7 @@ class CPUKernels { ShaderEvalFunction shader_eval_displace; ShaderEvalFunction shader_eval_background; + ShaderEvalFunction shader_eval_curve_shadow_transparency; /* Adaptive stopping. */ diff --git a/intern/cycles/device/device_kernel.cpp b/intern/cycles/device/device_kernel.cpp index ceaddee4756..e0833331b77 100644 --- a/intern/cycles/device/device_kernel.cpp +++ b/intern/cycles/device/device_kernel.cpp @@ -74,6 +74,8 @@ const char *device_kernel_as_string(DeviceKernel kernel) return "shader_eval_displace"; case DEVICE_KERNEL_SHADER_EVAL_BACKGROUND: return "shader_eval_background"; + case DEVICE_KERNEL_SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY: + return "shader_eval_curve_shadow_transparency"; /* Film. */ |