Code refactor: Split __VOLUME__ defines in Cycles.
* __VOLUME__ is basic volume support with Emission and Absorption. * __VOLUME_SCATTER__ enables volume Scattering support. * __VOLUME_DECOUPLED__ enables Decoupled Ray Marching.
This commit is contained in:
@@ -334,6 +334,7 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_homogeneous(KernelGloba
|
||||
float t = ray->t;
|
||||
float3 new_tp;
|
||||
|
||||
#ifdef __VOLUME_SCATTER__
|
||||
/* randomly scatter, and if we do t is shortened */
|
||||
if(closure_flag & SD_SCATTER) {
|
||||
/* extinction coefficient */
|
||||
@@ -387,7 +388,9 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_homogeneous(KernelGloba
|
||||
new_tp = *throughput * transmittance / pdf;
|
||||
}
|
||||
}
|
||||
else if(closure_flag & SD_ABSORPTION) {
|
||||
else
|
||||
#endif
|
||||
if(closure_flag & SD_ABSORPTION) {
|
||||
/* absorption only, no sampling needed */
|
||||
float3 transmittance = volume_color_transmittance(coeff.sigma_a, t);
|
||||
new_tp = *throughput * transmittance;
|
||||
@@ -464,6 +467,7 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_heterogeneous_distance(
|
||||
bool scatter = false;
|
||||
|
||||
/* distance sampling */
|
||||
#ifdef __VOLUME_SCATTER__
|
||||
if((closure_flag & SD_SCATTER) || (has_scatter && (closure_flag & SD_ABSORPTION))) {
|
||||
has_scatter = true;
|
||||
|
||||
@@ -499,7 +503,9 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_heterogeneous_distance(
|
||||
xi = 1.0f - (1.0f - xi)/sample_transmittance;
|
||||
}
|
||||
}
|
||||
else if(closure_flag & SD_ABSORPTION) {
|
||||
else
|
||||
#endif
|
||||
if(closure_flag & SD_ABSORPTION) {
|
||||
/* absorption only, no sampling needed */
|
||||
float3 sigma_a = coeff.sigma_a;
|
||||
|
||||
|
Reference in New Issue
Block a user