From 729dc98be167a77e418489d19042168863085845 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 18 Nov 2014 14:58:33 +0100 Subject: Fix T42475: Vector motion blur on hair Issue was caused by mismatch in pre/post transform matrix spaces for mesh and curve vectors. This happened because of current way how static transform apply works: it only stores post/pre in the world space if there's triangle motion exists. This lead to situation when there's no triangle motion happening but was hair motion happening. After long time of trying to solve it in a nice way, ended up solving it in a bit slow way -- pre/post transform is still storing in the same spaces as they used to be stored and just convert hair pre/post position to a world space in the kernel. This is because currently it's not so clear how to deal with cases when curve and mesh motion needs different space of pre/post transform (which happens in cases when only one of the motions exists). Would think of some magic, and meanwhile artists could be happy with proper render results. --- intern/cycles/kernel/geom/geom_primitive.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'intern/cycles') diff --git a/intern/cycles/kernel/geom/geom_primitive.h b/intern/cycles/kernel/geom/geom_primitive.h index 5df6c75df86..707977750bc 100644 --- a/intern/cycles/kernel/geom/geom_primitive.h +++ b/intern/cycles/kernel/geom/geom_primitive.h @@ -144,7 +144,8 @@ ccl_device float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *sd) float3 center; #ifdef __HAIR__ - if(sd->type & PRIMITIVE_ALL_CURVE) { + bool is_curve_primitive = sd->type & PRIMITIVE_ALL_CURVE; + if(is_curve_primitive) { center = curve_motion_center_location(kg, sd); if(!(sd->flag & SD_TRANSFORM_APPLIED)) @@ -170,6 +171,13 @@ ccl_device float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *sd) motion_pre = primitive_attribute_float3(kg, sd, elem, offset, NULL, NULL); motion_post = primitive_attribute_float3(kg, sd, elem, offset_next, NULL, NULL); + +#ifdef __HAIR__ + if(is_curve_primitive) { + object_position_transform(kg, sd, &motion_pre); + object_position_transform(kg, sd, &motion_post); + } +#endif } /* object motion. note that depending on the mesh having motion vectors, this -- cgit v1.2.3