diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-06-07 20:47:14 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-06-14 15:49:56 +0400 |
commit | 5fa68133c986be521e06b1f2558a33e56d27b98b (patch) | |
tree | 9310d597d7b3f07dd0c4842e971564ef738d75c0 /intern/cycles/kernel/kernel_path.h | |
parent | a29807cd63b0cba62e664c54ce34e5717ca51a3e (diff) |
Cycles: volume sampling method can now be set per material/world.
This gives you "Multiple Importance", "Distance" and "Equiangular" choices.
What multiple importance sampling does is make things more robust to certain
types of noise at the cost of a bit more noise in cases where the individual
strategies are always better.
So if you've got a pretty dense volume that's lit from far away then distance
sampling is usually more efficient. If you've got a light inside or near the
volume then equiangular sampling is better. If you have a combination of both,
then the multiple importance sampling will be better.
Diffstat (limited to 'intern/cycles/kernel/kernel_path.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 22024483bfc..d9ad348a952 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -89,7 +89,8 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, Ray ray, volume_ray.t = (hit)? isect.t: FLT_MAX; bool heterogeneous = volume_stack_is_heterogeneous(kg, state.volume_stack); - bool decoupled = kernel_volume_use_decoupled(kg, heterogeneous, false); + int sampling_method = volume_stack_sampling_method(kg, state.volume_stack); + bool decoupled = kernel_volume_use_decoupled(kg, heterogeneous, false, sampling_method); if(decoupled) { /* cache steps along volume for repeated sampling */ @@ -99,6 +100,8 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, Ray ray, shader_setup_from_volume(kg, &volume_sd, &volume_ray, state.bounce, state.transparent_bounce); kernel_volume_decoupled_record(kg, &state, &volume_ray, &volume_sd, &volume_segment, heterogeneous); + + volume_segment.sampling_method = sampling_method; /* emission */ if(volume_segment.closure_flag & SD_EMISSION) @@ -468,7 +471,8 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, volume_ray.t = (hit)? isect.t: FLT_MAX; bool heterogeneous = volume_stack_is_heterogeneous(kg, state.volume_stack); - bool decoupled = kernel_volume_use_decoupled(kg, heterogeneous, true); + int sampling_method = volume_stack_sampling_method(kg, state.volume_stack); + bool decoupled = kernel_volume_use_decoupled(kg, heterogeneous, true, sampling_method); if(decoupled) { /* cache steps along volume for repeated sampling */ @@ -479,6 +483,8 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, kernel_volume_decoupled_record(kg, &state, &volume_ray, &volume_sd, &volume_segment, heterogeneous); + volume_segment.sampling_method = sampling_method; + /* emission */ if(volume_segment.closure_flag & SD_EMISSION) path_radiance_accum_emission(&L, throughput, volume_segment.accum_emission, state.bounce); @@ -814,7 +820,10 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in /* direct light sampling */ if(volume_segment.closure_flag & SD_SCATTER) { + volume_segment.sampling_method = volume_stack_sampling_method(kg, state.volume_stack); + bool all = kernel_data.integrator.sample_all_lights_direct; + kernel_branched_path_volume_connect_light(kg, rng, &volume_sd, throughput, &state, &L, 1.0f, all, &volume_ray, &volume_segment); |