diff options
author | Patrick Mours <pmours@nvidia.com> | 2022-01-04 23:39:54 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2022-01-05 17:58:36 +0300 |
commit | 8393ccd07634b3152b18d4d527b1460dab9dbe06 (patch) | |
tree | 816b4dcaa9b8e5163c3934743fe1604f02983e71 /intern/cycles/kernel | |
parent | 86141a75ebc5d0517edf71f2bc2fe7d0d13d8b5e (diff) |
Cycles: Add OptiX temporal denoising support
Enables the `bpy.ops.cycles.denoise_animation()` operator again and modifies it to support
temporal denoising with OptiX. This requires renders that were done with both the "Vector"
and "Denoising Data" passes.
Differential Revision: https://developer.blender.org/D11442
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/device/gpu/kernel.h | 14 | ||||
-rw-r--r-- | intern/cycles/kernel/types.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/intern/cycles/kernel/device/gpu/kernel.h b/intern/cycles/kernel/device/gpu/kernel.h index b50f492e8c7..027b2a7a8c7 100644 --- a/intern/cycles/kernel/device/gpu/kernel.h +++ b/intern/cycles/kernel/device/gpu/kernel.h @@ -756,6 +756,7 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS) int guiding_pass_stride, int guiding_pass_albedo, int guiding_pass_normal, + int guiding_pass_flow, ccl_global const float *render_buffer, int render_offset, int render_stride, @@ -763,6 +764,7 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS) int render_pass_sample_count, int render_pass_denoising_albedo, int render_pass_denoising_normal, + int render_pass_motion, int full_x, int full_y, int width, @@ -814,6 +816,17 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS) normal_out[1] = normal_in[1] * pixel_scale; normal_out[2] = normal_in[2] * pixel_scale; } + + /* Flow pass. */ + if (guiding_pass_flow != PASS_UNUSED) { + kernel_assert(render_pass_motion != PASS_UNUSED); + + const float *motion_in = buffer + render_pass_motion; + float *flow_out = guiding_pixel + guiding_pass_flow; + + flow_out[0] = -motion_in[0] * pixel_scale; + flow_out[1] = -motion_in[1] * pixel_scale; + } } ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS) @@ -899,7 +912,6 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS) else { /* Assigning to zero since this is a default alpha value for 3-component passes, and it * is an opaque pixel for 4 component passes. */ - denoised_pixel[3] = 0; } } diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h index 1d0537f9547..5d41abb53c4 100644 --- a/intern/cycles/kernel/types.h +++ b/intern/cycles/kernel/types.h @@ -388,6 +388,7 @@ typedef enum PassType { PASS_DENOISING_NORMAL, PASS_DENOISING_ALBEDO, PASS_DENOISING_DEPTH, + PASS_DENOISING_PREVIOUS, /* PASS_SHADOW_CATCHER accumulates contribution of shadow catcher object which is not affected by * any other object. The pass accessor will divide the combined pass by the shadow catcher. The |