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
This commit is contained in:
Sergey Sharybin 2016-07-07 12:41:45 +02:00
parent a08e2179f1
commit 4beae09bae
Notes: blender-bot 2023-02-14 09:03:55 +01:00
Referenced by issue #49290, specific .blend with hair crashes in MacOS 2.78 RC1 on render
Referenced by issue #48808, Regression: Cycles OpenCL broken after Hair BVH commit
1 changed files with 3 additions and 3 deletions

View File

@ -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);