diff options
author | Sebastian Herholz <sebastian.herholz@intel.com> | 2022-10-06 15:39:44 +0300 |
---|---|---|
committer | Sebastian Herholz <sebastian.herholz@intel.com> | 2022-10-06 15:39:51 +0300 |
commit | e1a334875567418ab7a878d7ffac77f083ad8b10 (patch) | |
tree | 2efa09a4e8ead4353da345c9f830ae6c55c48de1 /intern/cycles/kernel/integrator | |
parent | 423c1366b05e1024f771ca0b5e2cfde65cbb9edc (diff) |
Fix T101458: Changing volume density when pg is enabled causes crash
Changing volume parameters during rendering could cause a crash
when guiding was enabled. It was due to an unintialized state paramter
at the beginning of the path tracing process.
In addition guiding is disabled when dealing with almost delta volumes
(i.e., g close to 1.0 or -1.0).
Diffstat (limited to 'intern/cycles/kernel/integrator')
-rw-r--r-- | intern/cycles/kernel/integrator/guiding.h | 5 | ||||
-rw-r--r-- | intern/cycles/kernel/integrator/path_state.h | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/intern/cycles/kernel/integrator/guiding.h b/intern/cycles/kernel/integrator/guiding.h index 5904b69b046..634bba2a9b4 100644 --- a/intern/cycles/kernel/integrator/guiding.h +++ b/intern/cycles/kernel/integrator/guiding.h @@ -501,6 +501,11 @@ ccl_device_forceinline bool guiding_phase_init(KernelGlobals kg, ccl_private float &rand) { #if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4 + /* we do not need to guide almost delta phase functions */ + if (fabsf(g) >= 0.99f) { + return false; + } + if (kg->opgl_volume_sampling_distribution->Init( kg->opgl_guiding_field, guiding_point3f(P), rand, true)) { kg->opgl_volume_sampling_distribution->ApplySingleLobeHenyeyGreensteinProduct(guiding_vec3f(D), diff --git a/intern/cycles/kernel/integrator/path_state.h b/intern/cycles/kernel/integrator/path_state.h index dbc6fc5a883..7197f0f2f3a 100644 --- a/intern/cycles/kernel/integrator/path_state.h +++ b/intern/cycles/kernel/integrator/path_state.h @@ -59,6 +59,13 @@ ccl_device_inline void path_state_init_integrator(KernelGlobals kg, #ifdef __PATH_GUIDING__ INTEGRATOR_STATE_WRITE(state, path, unguided_throughput) = 1.0f; INTEGRATOR_STATE_WRITE(state, guiding, path_segment) = nullptr; + INTEGRATOR_STATE_WRITE(state, guiding, use_surface_guiding) = false; + INTEGRATOR_STATE_WRITE(state, guiding, sample_surface_guiding_rand) = 0.5f; + INTEGRATOR_STATE_WRITE(state, guiding, surface_guiding_sampling_prob) = 0.0f; + INTEGRATOR_STATE_WRITE(state, guiding, bssrdf_sampling_prob) = 0.0f; + INTEGRATOR_STATE_WRITE(state, guiding, use_volume_guiding) = false; + INTEGRATOR_STATE_WRITE(state, guiding, sample_volume_guiding_rand) = 0.5f; + INTEGRATOR_STATE_WRITE(state, guiding, volume_guiding_sampling_prob) = 0.0f; #endif #ifdef __MNEE__ |