Fix T40695: world surface shader incorrectly visible with world volume.

This commit is contained in:
Brecht Van Lommel 2014-06-24 11:34:42 +02:00
parent 16baa8c273
commit 4b209f063c
Notes: blender-bot 2023-02-14 10:28:22 +01:00
Referenced by issue #40695, World surface shader visible when world volume shader is applied
2 changed files with 9 additions and 3 deletions

View File

@ -132,6 +132,9 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, Ray ray,
scatter = kernel_path_volume_bounce(kg, rng, &volume_sd, &throughput, &state, L, &ray, 1.0f);
}
if(result != VOLUME_PATH_SCATTERED)
throughput *= volume_segment.accum_transmittance;
/* free cached steps */
kernel_volume_decoupled_free(kg, &volume_segment);
@ -514,6 +517,9 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
scatter = kernel_path_volume_bounce(kg, rng, &volume_sd, &throughput, &state, &L, &ray, 1.0f);
}
if(result != VOLUME_PATH_SCATTERED)
throughput *= volume_segment.accum_transmittance;
/* free cached steps */
kernel_volume_decoupled_free(kg, &volume_segment);

View File

@ -741,8 +741,6 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(
{
int closure_flag = segment->closure_flag;
/* XXX add probalistic scattering! */
if(!(closure_flag & SD_SCATTER))
return VOLUME_PATH_MISSED;
@ -760,8 +758,10 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter(
/* rescale random number so we can reuse it */
xi = 1.0f - (1.0f - xi - sample_transmittance)/(1.0f - sample_transmittance);
}
else
else {
*throughput /= sample_transmittance;
return VOLUME_PATH_MISSED;
}
}
VolumeStep *step;