From d4c1e98dd4bc0b5a9a01d8ffffe747fe5b9ee73b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 9 Mar 2015 14:15:35 +0500 Subject: Fix T43484: Motion blur fails in certain circumstances The issue was caused by mismatch in how aligned triangles storage was filled in during BVH construction and how it was used during rendering. Basically, i was leaving uninitialized storage for triangles when there was deformation motion blur detected for the mesh. Was likely some sort of optimization, but in fact it's still possible that regular triangles would be needed for rendering. So now we're storing aligned storage for all triangle primitives and only skipping motion triangles (the deformation motion blur flag from mesh is now ignored). --- intern/cycles/bvh/bvh.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'intern/cycles/bvh/bvh.cpp') diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp index 2152349ed49..9fa602f0952 100644 --- a/intern/cycles/bvh/bvh.cpp +++ b/intern/cycles/bvh/bvh.cpp @@ -268,9 +268,6 @@ void BVH::pack_triangle(int idx, float4 woop[3]) assert(tob >= 0 && tob < objects.size()); const Mesh *mesh = objects[tob]->mesh; - if(mesh->has_motion_blur()) - return; - int tidx = pack.prim_index[idx]; const int *vidx = mesh->triangles[tidx].v; const float3* vpos = &mesh->verts[0]; @@ -299,9 +296,14 @@ void BVH::pack_primitives() if(pack.prim_index[i] != -1) { float4 woop[3]; - if(pack.prim_type[i] & PRIMITIVE_ALL_TRIANGLE) + if(pack.prim_type[i] & PRIMITIVE_TRIANGLE) { pack_triangle(i, woop); - + } + else { + /* Avoid use of uninitialized memory. */ + memset(&woop, 0, sizeof(woop)); + } + memcpy(&pack.tri_woop[i * nsize], woop, sizeof(float4)*3); int tob = pack.prim_object[i]; -- cgit v1.2.3