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 | 74afc86d4bf1a559e5b7a0cf5cea29cb508a3e99 (patch) | |
tree | 82243aaa4b5ff0e9c5098a336c5ef1e53381cd06 /intern/cycles/kernel/integrator/shade_light.h | |
parent | ae440703411486c9219fa0ff54e471eea64afb58 (diff) |
Cycles: remove ray offsetting
Remove small ray offsets that were used to avoid self intersection, and leave
that to the newly added primitive object/prim comparison. These changes together
significantly reduce artifacts on small, large or far away objects.
The balance here is that overlapping primitives are not handled well and should
be avoided (though this was already an issue). The upside is that this is
something a user has control over, whereas the other artifacts had no good
manual solution in many cases.
There is a known issue where the Blender particle system generates overlapping
objects and in turn leads to render differences between CPU and GPU. This will
be addressed separately.
Differential Revision: https://developer.blender.org/D12954
Diffstat (limited to 'intern/cycles/kernel/integrator/shade_light.h')
-rw-r--r-- | intern/cycles/kernel/integrator/shade_light.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/intern/cycles/kernel/integrator/shade_light.h b/intern/cycles/kernel/integrator/shade_light.h index 97ca430752c..0a82c9cadef 100644 --- a/intern/cycles/kernel/integrator/shade_light.h +++ b/intern/cycles/kernel/integrator/shade_light.h @@ -37,8 +37,9 @@ ccl_device_inline void integrate_light(KernelGlobals kg, /* Advance ray beyond light. */ /* TODO: can we make this more numerically robust to avoid reintersecting the - * same light in some cases? */ - const float3 new_ray_P = ray_offset(ray_P + ray_D * isect.t, ray_D); + * same light in some cases? Ray should not intersect surface anymore as the + * object and prim ids will prevent self intersection. */ + const float3 new_ray_P = ray_P + ray_D * isect.t; INTEGRATOR_STATE_WRITE(state, ray, P) = new_ray_P; INTEGRATOR_STATE_WRITE(state, ray, t) -= isect.t; @@ -46,7 +47,7 @@ ccl_device_inline void integrate_light(KernelGlobals kg, const float mis_ray_t = INTEGRATOR_STATE(state, path, mis_ray_t); ray_P -= ray_D * mis_ray_t; isect.t += mis_ray_t; - INTEGRATOR_STATE_WRITE(state, path, mis_ray_t) = mis_ray_t + isect.t; + INTEGRATOR_STATE_WRITE(state, path, mis_ray_t) = isect.t; LightSample ls ccl_optional_struct_init; const bool use_light_sample = light_sample_from_intersection(kg, &isect, ray_P, ray_D, &ls); |