Cycles: Further tweak for Decoupled Ray Marching
Avoid some if checks when probalistic_scatter is false. Differential Revision: https://developer.blender.org/D743
This commit is contained in:
@@ -851,7 +851,8 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
|
|||||||
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
||||||
&ps, &pray, &volume_sd, &tp, rphase, rscatter, &volume_segment, NULL, false);
|
&ps, &pray, &volume_sd, &tp, rphase, rscatter, &volume_segment, NULL, false);
|
||||||
|
|
||||||
if(result == VOLUME_PATH_SCATTERED) {
|
kernel_assert(result == VOLUME_PATH_SCATTERED);
|
||||||
|
|
||||||
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &tp, &ps, &L, &pray, num_samples_inv)) {
|
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &tp, &ps, &L, &pray, num_samples_inv)) {
|
||||||
kernel_path_indirect(kg, rng, pray, tp*num_samples_inv, num_samples, ps, &L);
|
kernel_path_indirect(kg, rng, pray, tp*num_samples_inv, num_samples, ps, &L);
|
||||||
|
|
||||||
@@ -862,7 +863,6 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* emission and transmittance */
|
/* emission and transmittance */
|
||||||
if(volume_segment.closure_flag & SD_EMISSION)
|
if(volume_segment.closure_flag & SD_EMISSION)
|
||||||
|
@@ -145,8 +145,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
|||||||
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
||||||
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
||||||
|
|
||||||
if(result != VOLUME_PATH_SCATTERED)
|
kernel_assert(result == VOLUME_PATH_SCATTERED);
|
||||||
continue;
|
|
||||||
|
|
||||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
/* todo: split up light_sample so we don't have to call it again with new position */
|
||||||
lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls);
|
lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls);
|
||||||
@@ -196,8 +195,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
|||||||
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
||||||
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
||||||
|
|
||||||
if(result != VOLUME_PATH_SCATTERED)
|
kernel_assert(result == VOLUME_PATH_SCATTERED);
|
||||||
continue;
|
|
||||||
|
|
||||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
/* todo: split up light_sample so we don't have to call it again with new position */
|
||||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
||||||
@@ -235,8 +233,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
|||||||
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
||||||
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
||||||
|
|
||||||
if(result != VOLUME_PATH_SCATTERED)
|
kernel_assert(result == VOLUME_PATH_SCATTERED);
|
||||||
return;
|
|
||||||
|
|
||||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
/* todo: split up light_sample so we don't have to call it again with new position */
|
||||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
||||||
|
@@ -732,7 +732,9 @@ ccl_device void kernel_volume_decoupled_free(KernelGlobals *kg, VolumeSegment *s
|
|||||||
* scattering, they always scatter if there is any non-zero scattering
|
* scattering, they always scatter if there is any non-zero scattering
|
||||||
* coefficient.
|
* coefficient.
|
||||||
*
|
*
|
||||||
* these also do not do emission or modify throughput. */
|
* these also do not do emission or modify throughput.
|
||||||
|
*
|
||||||
|
* function is expected to return VOLUME_PATH_SCATTERED when probalistic_scatter is false */
|
||||||
ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(
|
ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(
|
||||||
KernelGlobals *kg, PathState *state, Ray *ray, ShaderData *sd,
|
KernelGlobals *kg, PathState *state, Ray *ray, ShaderData *sd,
|
||||||
float3 *throughput, float rphase, float rscatter,
|
float3 *throughput, float rphase, float rscatter,
|
||||||
|
Reference in New Issue
Block a user