Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-02-25 17:12:11 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-03-25 15:42:13 +0300
commit0e47e0cc9e9b19a30717042d97cb3b8fb50132ff (patch)
treee735d1d52faf96df09e292e5338f4a4af1499de3 /intern/cycles/bvh
parent712a2579944fb9ee00fe3c6c34f07f2800361396 (diff)
Cycles: Use dedicated BVH for subsurface ray casting
This commit makes it so casting subsurface rays will totally ignore all the BVH nodes and primitives which do not belong to a current object, making it much simpler traversal code and reduces number of intersection tests. Reviewers: brecht, juicyfruit, dingto, lukasstockner97 Differential Revision: https://developer.blender.org/D1823
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r--intern/cycles/bvh/bvh.cpp9
-rw-r--r--intern/cycles/bvh/bvh_build.cpp4
2 files changed, 7 insertions, 6 deletions
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 4a5f8b1bda6..f78ad3e9ce2 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -233,7 +233,7 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
Mesh *mesh = ob->mesh;
BVH *bvh = mesh->bvh;
- if(!mesh->transform_applied) {
+ if(mesh->need_build_bvh()) {
if(mesh_map.find(mesh) == mesh_map.end()) {
prim_index_size += bvh->pack.prim_index.size();
tri_woop_size += bvh->pack.tri_woop.size();
@@ -268,9 +268,10 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
foreach(Object *ob, objects) {
Mesh *mesh = ob->mesh;
- /* if mesh transform is applied, that means it's already in the top
- * level BVH, and we don't need to merge it in */
- if(mesh->transform_applied) {
+ /* We assume that if mesh doesn't need own BVH it was already included
+ * into a top-level BVH and no packing here is needed.
+ */
+ if(!mesh->need_build_bvh()) {
pack.object_node[object_offset++] = 0;
continue;
}
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 45b0aaa2d63..a8b9fe0d52b 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -180,7 +180,7 @@ void BVHBuild::add_references(BVHRange& root)
foreach(Object *ob, objects) {
if(params.top_level) {
- if(ob->mesh->transform_applied) {
+ if(!ob->mesh->is_instanced()) {
num_alloc_references += ob->mesh->triangles.size();
num_alloc_references += count_curve_segments(ob->mesh);
}
@@ -201,7 +201,7 @@ void BVHBuild::add_references(BVHRange& root)
foreach(Object *ob, objects) {
if(params.top_level) {
- if(ob->mesh->transform_applied)
+ if(!ob->mesh->is_instanced())
add_reference_mesh(bounds, center, ob->mesh, i);
else
add_reference_object(bounds, center, ob, i);