commit 01206b85aac286a715c1673ddf7a86a0dab7ef00
parent 2172c05c7483399eb5e732ca18e8304213b14773
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 6 May 2025 15:47:14 +0200
Fix longwave volume scattering
Since the commit be1da72 the source is no longer defined in longwave but
it was still (unnecessarily) questioned to manage volume diffusion.
Which led to a crash that this commit fixes.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/planets/htrdr_planets_compute_radiance.c b/src/planets/htrdr_planets_compute_radiance.c
@@ -504,9 +504,6 @@ volume_scattering
ssf_phase_sample(phase, args->rng, wo, sc_dir, NULL);
- /* Sample a direction toward the source */
- pdf = htrdr_planets_source_sample_direction(cmd->source, args->rng, sc_pos, wi);
-
/* In short wave, manage the contribution of the external source */
switch(cmd->spectral_domain.type) {
case HTRDR_SPECTRAL_LW:
@@ -515,6 +512,10 @@ volume_scattering
case HTRDR_SPECTRAL_SW:
case HTRDR_SPECTRAL_SW_CIE_XYZ:
+ /* Sample a direction toward the source */
+ pdf = htrdr_planets_source_sample_direction
+ (cmd->source, args->rng, sc_pos, wi);
+
/* Calculate the direct contribution at the scattering position */
Ld = direct_contribution(cmd, args, sc_pos, wi, NULL);
rho = ssf_phase_eval(phase, wo, wi);