diff options
author | Stefan Werner <stefan.werner@tangent-animation.com> | 2018-11-23 15:08:15 +0300 |
---|---|---|
committer | Stefan Werner <stefan.werner@tangent-animation.com> | 2018-11-23 15:19:53 +0300 |
commit | 071f4f4ce0b9520ab0c73d6d68365ad449ca8b80 (patch) | |
tree | 9f37bfcac669366b9ad5fb7605f2fbbed9b71b0a /intern/cycles/render/mesh.cpp | |
parent | 0a2b2d59a5897212ba3771503feb6770fb636bc8 (diff) |
Cycles: Improved robustness of hair motion blur.motion_curve_fix
In some instances, the number of control vertices of a hair could change mid-frame.
Cycles would then be unable to calculate proper motion blur for those hairs. This adds
interpolated CVs to fill in for the missing data. While this will not necessarily result in
a fully accurate reconstruction of the guide hair, it preserves motion blur instead of disabling it.
Reviewers: #cycles, sergey
Reviewed By: #cycles, sergey
Subscribers: sergey, brecht, #cycles
Tags: #cycles
Differential Revision: https://developer.blender.org/D3695
Diffstat (limited to 'intern/cycles/render/mesh.cpp')
-rw-r--r-- | intern/cycles/render/mesh.cpp | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 8a00b88af12..5f884a3f871 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -39,6 +39,10 @@ #include "util/util_progress.h" #include "util/util_set.h" +#ifdef WITH_EMBREE +# include "bvh/bvh_embree.h" +#endif + CCL_NAMESPACE_BEGIN /* Triangle */ @@ -1068,11 +1072,14 @@ void Mesh::compute_bvh(Device *device, bparams.use_spatial_split = params->use_bvh_spatial_split; bparams.bvh_layout = BVHParams::best_bvh_layout( params->bvh_layout, - device->info.bvh_layout_mask); + device->get_bvh_layout_mask()); bparams.use_unaligned_nodes = dscene->data.bvh.have_curves && params->use_bvh_unaligned_nodes; bparams.num_motion_triangle_steps = params->num_bvh_time_steps; bparams.num_motion_curve_steps = params->num_bvh_time_steps; + bparams.bvh_type = params->bvh_type; + bparams.curve_flags = dscene->data.curve.curveflags; + bparams.curve_subdivisions = dscene->data.curve.subdivisions; delete bvh; bvh = BVH::create(bparams, objects); @@ -1284,9 +1291,9 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att } } #else - (void)device; - (void)scene; - (void)mesh_attributes; + (void) device; + (void) scene; + (void) mesh_attributes; #endif } @@ -1855,20 +1862,38 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene * bparams.top_level = true; bparams.bvh_layout = BVHParams::best_bvh_layout( scene->params.bvh_layout, - device->info.bvh_layout_mask); + device->get_bvh_layout_mask()); bparams.use_spatial_split = scene->params.use_bvh_spatial_split; bparams.use_unaligned_nodes = dscene->data.bvh.have_curves && scene->params.use_bvh_unaligned_nodes; bparams.num_motion_triangle_steps = scene->params.num_bvh_time_steps; bparams.num_motion_curve_steps = scene->params.num_bvh_time_steps; + bparams.bvh_type = scene->params.bvh_type; + bparams.curve_flags = dscene->data.curve.curveflags; + bparams.curve_subdivisions = dscene->data.curve.subdivisions; VLOG(1) << "Using " << bvh_layout_name(bparams.bvh_layout) << " layout."; +#ifdef WITH_EMBREE + if(bparams.bvh_layout == BVH_LAYOUT_EMBREE) { + if(dscene->data.bvh.scene) { + BVHEmbree::destroy(dscene->data.bvh.scene); + } + } +#endif + BVH *bvh = BVH::create(bparams, scene->objects); - bvh->build(progress); + bvh->build(progress, &device->stats); if(progress.get_cancel()) { +#ifdef WITH_EMBREE + if(bparams.bvh_layout == BVH_LAYOUT_EMBREE) { + if(dscene->data.bvh.scene) { + BVHEmbree::destroy(dscene->data.bvh.scene); + } + } +#endif delete bvh; return; } @@ -1923,6 +1948,16 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene * dscene->data.bvh.bvh_layout = bparams.bvh_layout; dscene->data.bvh.use_bvh_steps = (scene->params.num_bvh_time_steps != 0); + +#ifdef WITH_EMBREE + if(bparams.bvh_layout == BVH_LAYOUT_EMBREE) { + dscene->data.bvh.scene = ((BVHEmbree*)bvh)->scene; + } + else { + dscene->data.bvh.scene = NULL; + } +#endif + delete bvh; } @@ -2266,7 +2301,7 @@ void MeshManager::device_free(Device *device, DeviceScene *dscene) og->object_names.clear(); } #else - (void)device; + (void) device; #endif } |