diff options
author | William Leeson <leesonw> | 2022-01-13 19:20:50 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-01-26 19:51:05 +0300 |
commit | ae440703411486c9219fa0ff54e471eea64afb58 (patch) | |
tree | 285443f953e6e89de24dad6ad5012ed2d488e182 /intern/cycles/kernel/light | |
parent | a9bb4607660a2f68a78732fd7f5d5280d8075dcb (diff) |
Cycles: explicitly skip self-intersection
Remember the last intersected primitive and skip any intersections with the
same primitive.
Ref D12954
Diffstat (limited to 'intern/cycles/kernel/light')
-rw-r--r-- | intern/cycles/kernel/light/light.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/light/sample.h | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/intern/cycles/kernel/light/light.h b/intern/cycles/kernel/light/light.h index 6e445f862db..b9c0b533518 100644 --- a/intern/cycles/kernel/light/light.h +++ b/intern/cycles/kernel/light/light.h @@ -418,8 +418,8 @@ ccl_device bool light_sample_from_intersection(KernelGlobals kg, LightType type = (LightType)klight->type; ls->type = type; ls->shader = klight->shader_id; - ls->object = PRIM_NONE; - ls->prim = PRIM_NONE; + ls->object = isect->object; + ls->prim = isect->prim; ls->lamp = lamp; /* todo: missing texture coordinates */ ls->t = isect->t; diff --git a/intern/cycles/kernel/light/sample.h b/intern/cycles/kernel/light/sample.h index 7dbc783b1bb..65e87e77c36 100644 --- a/intern/cycles/kernel/light/sample.h +++ b/intern/cycles/kernel/light/sample.h @@ -257,6 +257,12 @@ ccl_device_inline void shadow_ray_setup(ccl_private const ShaderData *ccl_restri ray->dP = differential_make_compact(sd->dP); ray->dD = differential_zero_compact(); ray->time = sd->time; + + /* Fill in intersection surface and light details. */ + ray->self.prim = sd->prim; + ray->self.object = sd->object; + ray->self.light_prim = ls->prim; + ray->self.light_object = ls->object; } /* Create shadow ray towards light sample. */ |