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_volume.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_volume.h')
-rw-r--r-- | intern/cycles/kernel/kernel_volume.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h index 0a74a9deba9..a8cd7b0b4c0 100644 --- a/intern/cycles/kernel/kernel_volume.h +++ b/intern/cycles/kernel/kernel_volume.h @@ -39,7 +39,7 @@ typedef struct VolumeShaderCoefficients { ccl_device bool volume_shader_extinction_sample(KernelGlobals *kg, ShaderData *sd, PathState *state, float3 P, float3 *extinction) { sd->P = P; - shader_eval_volume(kg, sd, state->volume_stack, PATH_RAY_SHADOW, SHADER_CONTEXT_SHADOW); + shader_eval_volume(kg, sd, state, state->volume_stack, PATH_RAY_SHADOW, SHADER_CONTEXT_SHADOW); if(!(sd->flag & (SD_ABSORPTION|SD_SCATTER))) return false; @@ -61,7 +61,7 @@ ccl_device bool volume_shader_extinction_sample(KernelGlobals *kg, ShaderData *s ccl_device bool volume_shader_sample(KernelGlobals *kg, ShaderData *sd, PathState *state, float3 P, VolumeShaderCoefficients *coeff) { sd->P = P; - shader_eval_volume(kg, sd, state->volume_stack, state->flag, SHADER_CONTEXT_VOLUME); + shader_eval_volume(kg, sd, state, state->volume_stack, state->flag, SHADER_CONTEXT_VOLUME); if(!(sd->flag & (SD_ABSORPTION|SD_SCATTER|SD_EMISSION))) return false; @@ -222,7 +222,7 @@ ccl_device void kernel_volume_shadow_heterogeneous(KernelGlobals *kg, PathState ccl_device_noinline void kernel_volume_shadow(KernelGlobals *kg, PathState *state, Ray *ray, float3 *throughput) { ShaderData sd; - shader_setup_from_volume(kg, &sd, ray, state->bounce, state->transparent_bounce); + shader_setup_from_volume(kg, &sd, ray); if(volume_stack_is_heterogeneous(kg, state->volume_stack)) kernel_volume_shadow_heterogeneous(kg, state, ray, &sd, throughput); @@ -567,7 +567,7 @@ ccl_device_noinline VolumeIntegrateResult kernel_volume_integrate(KernelGlobals * performance of rendering without volumes */ RNG tmp_rng = cmj_hash(*rng, state->rng_offset); - shader_setup_from_volume(kg, sd, ray, state->bounce, state->transparent_bounce); + shader_setup_from_volume(kg, sd, ray); if(heterogeneous) return kernel_volume_integrate_heterogeneous_distance(kg, state, ray, sd, L, throughput, &tmp_rng); @@ -1008,7 +1008,7 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg, for(uint hit = 0; hit < num_hits; ++hit, ++isect) { ShaderData sd; - shader_setup_from_ray(kg, &sd, isect, &volume_ray, 0, 0); + shader_setup_from_ray(kg, &sd, isect, &volume_ray); if(sd.flag & SD_BACKFACING) { /* If ray exited the volume and never entered to that volume * it means that camera is inside such a volume. @@ -1048,7 +1048,7 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg, } ShaderData sd; - shader_setup_from_ray(kg, &sd, &isect, &volume_ray, 0, 0); + shader_setup_from_ray(kg, &sd, &isect, &volume_ray); if(sd.flag & SD_BACKFACING) { /* If ray exited the volume and never entered to that volume * it means that camera is inside such a volume. @@ -1162,7 +1162,7 @@ ccl_device void kernel_volume_stack_update_for_subsurface(KernelGlobals *kg, for(uint hit = 0; hit < num_hits; ++hit, ++isect) { ShaderData sd; - shader_setup_from_ray(kg, &sd, isect, &volume_ray, 0, 0); + shader_setup_from_ray(kg, &sd, isect, &volume_ray); kernel_volume_stack_enter_exit(kg, &sd, stack); } } @@ -1173,7 +1173,7 @@ ccl_device void kernel_volume_stack_update_for_subsurface(KernelGlobals *kg, scene_intersect_volume(kg, &volume_ray, &isect)) { ShaderData sd; - shader_setup_from_ray(kg, &sd, &isect, &volume_ray, 0, 0); + shader_setup_from_ray(kg, &sd, &isect, &volume_ray); kernel_volume_stack_enter_exit(kg, &sd, stack); /* Move ray forward. */ |