diff options
author | Thomas Dinges <blender@dingto.org> | 2016-01-07 01:38:13 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2016-01-07 01:43:29 +0300 |
commit | 83e73a2100688655f0eb2df5cbfac2ca1f051fff (patch) | |
tree | 76f1cd502187544777b61fa55f5695b2503993a8 /intern/cycles/kernel/kernel_path.h | |
parent | be28706bacfb95e7c3c1b58b183acda0e35977f8 (diff) |
Cycles: Refactor how we pass bounce info to light path node.
This commit changes the way how we pass bounce information to the Light
Path node. Instead of manualy copying the bounces into ShaderData, we now
directly pass PathState. This reduces the arguments that we need to pass
around and also makes it easier to extend the feature.
This commit also exposes the Transmission Bounce Depth to the Light Path
node. It works similar to the Transparent Depth Output: Replace a
Transmission lightpath after X bounces with another shader, e.g a Diffuse
one. This can be used to avoid black surfaces, due to low amount of max
bounces.
Reviewed by Sergey and Brecht, thanks for some hlp with this.
I tested compilation and usage on CPU (SVM and OSL), CUDA, OpenCL Split
and Mega kernel. Hopefully this covers all devices. :)
Diffstat (limited to 'intern/cycles/kernel/kernel_path.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 82cad788eb0..fc32201596f 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -119,9 +119,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, shader_setup_from_volume(kg, &volume_sd, - &volume_ray, - state->bounce, - state->transparent_bounce); + &volume_ray); kernel_volume_decoupled_record(kg, state, &volume_ray, @@ -252,11 +250,9 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, shader_setup_from_ray(kg, &sd, &isect, - ray, - state->bounce, - state->transparent_bounce); + ray); float rbsdf = path_state_rng_1D_for_decision(kg, rng, state, PRNG_BSDF); - shader_eval_surface(kg, &sd, rbsdf, state->flag, SHADER_CONTEXT_INDIRECT); + shader_eval_surface(kg, &sd, state, rbsdf, state->flag, SHADER_CONTEXT_INDIRECT); #ifdef __BRANCHED_PATH__ shader_merge_closures(&sd); #endif @@ -366,6 +362,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, &bssrdf_u, &bssrdf_v); subsurface_scatter_step(kg, &sd, + state, state->flag, sc, &lcg_state, @@ -481,6 +478,7 @@ ccl_device bool kernel_path_subsurface_scatter( &ss_isect, hit, sd, + state, state->flag, sc, false); @@ -684,7 +682,7 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, VolumeSegment volume_segment; ShaderData volume_sd; - shader_setup_from_volume(kg, &volume_sd, &volume_ray, state.bounce, state.transparent_bounce); + shader_setup_from_volume(kg, &volume_sd, &volume_ray); kernel_volume_decoupled_record(kg, &state, &volume_ray, &volume_sd, &volume_segment, heterogeneous); @@ -774,9 +772,9 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, /* setup shading */ ShaderData sd; - shader_setup_from_ray(kg, &sd, &isect, &ray, state.bounce, state.transparent_bounce); + shader_setup_from_ray(kg, &sd, &isect, &ray); float rbsdf = path_state_rng_1D_for_decision(kg, rng, &state, PRNG_BSDF); - shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_MAIN); + shader_eval_surface(kg, &sd, &state, rbsdf, state.flag, SHADER_CONTEXT_MAIN); /* holdout */ #ifdef __HOLDOUT__ |