[Bf-blender-cvs] [4beae09] master: Cycles: Enable unaligned BVH builder for scenes with hair

Sergey Sharybin noreply at git.blender.org
Thu Jul 7 17:29:12 CEST 2016


Commit: 4beae09bae56e3f0116b745099a1226c82572bdd
Author: Sergey Sharybin
Date:   Thu Jul 7 12:41:45 2016 +0200
Branches: master
https://developer.blender.org/rB4beae09bae56e3f0116b745099a1226c82572bdd

Cycles: Enable unaligned BVH builder for scenes with hair

This commit enables new unaligned BVH builder and traversal for scenes
with hair. This happens automatically, no need of manual control over
this.

There are some possible optimization still to happen here and there,
but overall there's already nice speedup:

                      Master                 Hair BVH
  bunny.blend         8:06.54                 5:57.14
  victor.blend       16:07.44                15:37.35

Unfortunately, such more complexity is not really coming for free,
so there's some downsides, but those are within acceptable range:

                      Master                Hair BVH
  classroom.blend     5:31.79                5:35.11
  barcelona.blend     4:38.58                4:44.51

Memory usage is also somewhat bigger for hairy scenes, but speed
benefit pays well for that. Additionally as was mentioned in one
of previous commits we can add an option to disable hair BVH and
have similar render time but have memory saving.

Reviewers: brecht, dingto, lukasstockner97, juicyfruit, maiself

Differential Revision: https://developer.blender.org/D2086

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

M	intern/cycles/render/mesh.cpp

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

diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 24cfb47..661719e 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -553,7 +553,7 @@ void Mesh::pack_curves(Scene *scene, float4 *curve_key_co, float4 *curve_data, s
 	}
 }
 
-void Mesh::compute_bvh(DeviceScene * /*dscene*/,
+void Mesh::compute_bvh(DeviceScene *dscene,
                        SceneParams *params,
                        Progress *progress,
                        int n,
@@ -588,7 +588,7 @@ void Mesh::compute_bvh(DeviceScene * /*dscene*/,
 			BVHParams bparams;
 			bparams.use_spatial_split = params->use_bvh_spatial_split;
 			bparams.use_qbvh = params->use_qbvh;
-			bparams.use_unaligned_nodes = false;
+			bparams.use_unaligned_nodes = dscene->data.bvh.have_curves;
 
 			delete bvh;
 			bvh = BVH::create(bparams, objects);
@@ -1222,7 +1222,7 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
 	bparams.top_level = true;
 	bparams.use_qbvh = scene->params.use_qbvh;
 	bparams.use_spatial_split = scene->params.use_bvh_spatial_split;
-	bparams.use_unaligned_nodes = false;
+	bparams.use_unaligned_nodes = dscene->data.bvh.have_curves;
 
 	delete bvh;
 	bvh = BVH::create(bparams, scene->objects);




More information about the Bf-blender-cvs mailing list