From a60c3c6b21b835ab9160becd4bded0573e1b23a9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 11 Jan 2016 21:15:09 +0500 Subject: Cycles: Fix for SSS objects being black when combined with motion blur --- intern/cycles/kernel/kernel_subsurface.h | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'intern') diff --git a/intern/cycles/kernel/kernel_subsurface.h b/intern/cycles/kernel/kernel_subsurface.h index 1189f4ce406..2685cc009df 100644 --- a/intern/cycles/kernel/kernel_subsurface.h +++ b/intern/cycles/kernel/kernel_subsurface.h @@ -293,10 +293,29 @@ ccl_device int subsurface_scatter_multi_intersect( for(int hit = 0; hit < num_eval_hits; hit++) { /* Quickly retrieve P and Ng without setting up ShaderData. */ - float3 hit_P = triangle_refine_subsurface(kg, - sd, - &ss_isect->hits[hit], - ray); + float3 hit_P; + if(ccl_fetch(sd, type) & PRIMITIVE_TRIANGLE) { + hit_P = triangle_refine_subsurface(kg, + sd, + &ss_isect->hits[hit], + ray); + } +#ifdef __OBJECT_MOTION__ + else if(ccl_fetch(sd, type) & PRIMITIVE_MOTION_TRIANGLE) { + float3 verts[3]; + motion_triangle_vertices(kg, + ccl_fetch(sd, object), + ccl_fetch(sd, prim), + ccl_fetch(sd, time), + verts); + hit_P = motion_triangle_refine_subsurface(kg, + sd, + &ss_isect->hits[hit], + ray, + verts); + } +#endif /* __OBJECT_MOTION__ */ + float3 hit_Ng = ss_isect->Ng[hit]; if(ss_isect->hits[hit].object != OBJECT_NONE) { object_normal_transform(kg, sd, &hit_Ng); -- cgit v1.2.3