diff options
author | Sam Kottler <dev@samkottler.net> | 2020-06-19 21:14:00 +0300 |
---|---|---|
committer | Sam Kottler <dev@samkottler.net> | 2020-06-19 21:14:00 +0300 |
commit | 6331385a503664c0da1d22d260e274b931865590 (patch) | |
tree | e15e78e47386441058f71b5fba7431d4335ff955 | |
parent | c86eb358fc635a82a971c38c7d42b6d573863a42 (diff) |
Fixed how last not-transparent bounce is found.
Was using emission_sd if most recent bounce was transparent, but this
is incorrect. Now it uses the ray_N PathState for normal and
recalculates the point.
-rw-r--r-- | intern/cycles/kernel/kernel_emission.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 21 |
2 files changed, 6 insertions, 25 deletions
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index 5e04f52a22c..46ff209e6f1 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -349,14 +349,8 @@ ccl_device_noinline_cpu float3 indirect_background(KernelGlobals *kg, /* consider shading point at previous non-transparent bounce */ float3 P_pick; float3 N_pick; - if (state->ray_t == 0.0f) { // Non-transparent bounce - P_pick = emission_sd->P_pick; - N_pick = emission_sd->N_pick; - } - else { // Transparent bounce - P_pick = ray->P - state->ray_t * ray->D; - N_pick = state->ray_N; - } + P_pick = ray->P - state->ray_t * ray->D; + N_pick = state->ray_N; /* check if background light exists or if we should skip pdf */ int res_x = kernel_data.integrator.pdf_background_res_x; diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index af9833385b4..84ccb48bdf9 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -98,15 +98,8 @@ ccl_device_forceinline void kernel_path_lamp_emission(KernelGlobals *kg, /* ray starting from previous non-transparent bounce */ Ray light_ray ccl_optional_struct_init; float3 N_pick; - if (state->ray_t == 0.0f) { - light_ray.P = emission_sd->P_pick; - N_pick = emission_sd->N_pick; - } - else { - /* Current bounce was on a transparent surface */ - light_ray.P = ray->P - state->ray_t * ray->D; - N_pick = state->ray_N; - } + light_ray.P = ray->P - state->ray_t * ray->D; + N_pick = state->ray_N; state->ray_t += isect->t; light_ray.D = ray->D; @@ -337,14 +330,8 @@ ccl_device_forceinline bool kernel_path_shader_apply(KernelGlobals *kg, /* ray starting from previous non-transparent bounce */ float3 P_pick; float3 N_pick; - if (state->ray_t == 0.0f) { // Non-transparent bounce - P_pick = sd->P_pick; - N_pick = sd->N_pick; - } - else { // Transparent bounce - P_pick = ray->P - state->ray_t * ray->D; - N_pick = state->ray_N; - } + P_pick = ray->P - state->ray_t * ray->D; + N_pick = state->ray_N; float ray_length = state->ray_t + sd->ray_length; |