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.
This commit is contained in:
parent
c07241dd18
commit
729dc98be1
Notes:
blender-bot
2023-02-14 09:51:54 +01:00
Referenced by issue #42475, Vector motion blur on hair.
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue