From e760972221e68d3c81f2ee3687cc71836dde8ae9 Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Wed, 4 Dec 2019 19:57:28 +0100 Subject: Cycles: support for custom shader AOVs Custom render passes are added in the Shader AOVs panel in the view layer settings, with a name and data type. In shader nodes, an AOV Output node is then used to output either a value or color to the pass. Arbitrary names can be used for these passes, as long as they don't conflict with built-in passes that are enabled. The AOV Output node can be used in both material and world shader nodes. Implemented by Lukas, with tweaks by Brecht. Differential Revision: https://developer.blender.org/D4837 --- intern/cycles/kernel/split/kernel_indirect_background.h | 4 +++- intern/cycles/kernel/split/kernel_shader_eval.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'intern/cycles/kernel/split') diff --git a/intern/cycles/kernel/split/kernel_indirect_background.h b/intern/cycles/kernel/split/kernel_indirect_background.h index b1c65f61e2c..6d500650cc0 100644 --- a/intern/cycles/kernel/split/kernel_indirect_background.h +++ b/intern/cycles/kernel/split/kernel_indirect_background.h @@ -58,8 +58,10 @@ ccl_device void kernel_indirect_background(KernelGlobals *kg) ccl_global Ray *ray = &kernel_split_state.ray[ray_index]; float3 throughput = kernel_split_state.throughput[ray_index]; ShaderData *sd = kernel_split_sd(sd, ray_index); + uint buffer_offset = kernel_split_state.buffer_offset[ray_index]; + ccl_global float *buffer = kernel_split_params.tile.buffer + buffer_offset; - kernel_path_background(kg, state, ray, throughput, sd, L); + kernel_path_background(kg, state, ray, throughput, sd, buffer, L); kernel_split_path_end(kg, ray_index); } } diff --git a/intern/cycles/kernel/split/kernel_shader_eval.h b/intern/cycles/kernel/split/kernel_shader_eval.h index 8e39c9797e5..c760a2b2049 100644 --- a/intern/cycles/kernel/split/kernel_shader_eval.h +++ b/intern/cycles/kernel/split/kernel_shader_eval.h @@ -50,8 +50,10 @@ ccl_device void kernel_shader_eval(KernelGlobals *kg) ccl_global char *ray_state = kernel_split_state.ray_state; if (IS_STATE(ray_state, ray_index, RAY_ACTIVE)) { ccl_global PathState *state = &kernel_split_state.path_state[ray_index]; + uint buffer_offset = kernel_split_state.buffer_offset[ray_index]; + ccl_global float *buffer = kernel_split_params.tile.buffer + buffer_offset; - shader_eval_surface(kg, kernel_split_sd(sd, ray_index), state, state->flag); + shader_eval_surface(kg, kernel_split_sd(sd, ray_index), state, buffer, state->flag); #ifdef __BRANCHED_PATH__ if (kernel_data.integrator.branched) { shader_merge_closures(kernel_split_sd(sd, ray_index)); -- cgit v1.2.3