[Bf-blender-cvs] [d4c1e98] master: Fix T43484: Motion blur fails in certain circumstances

Sergey Sharybin noreply at git.blender.org
Mon Mar 9 10:18:53 CET 2015


Commit: d4c1e98dd4bc0b5a9a01d8ffffe747fe5b9ee73b
Author: Sergey Sharybin
Date:   Mon Mar 9 14:15:35 2015 +0500
Branches: master
https://developer.blender.org/rBd4c1e98dd4bc0b5a9a01d8ffffe747fe5b9ee73b

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).

===================================================================

M	intern/cycles/bvh/bvh.cpp

===================================================================

diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 2152349..9fa602f 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];




More information about the Bf-blender-cvs mailing list