[Bf-blender-cvs] [0091b84df02] master: Fix T70268: Render failures with Vector pass active with OptiX in Cycles

Patrick Mours noreply at git.blender.org
Wed Oct 2 13:23:57 CEST 2019


Commit: 0091b84df0281c44c98194cf94af7e894ff990e5
Author: Patrick Mours
Date:   Wed Oct 2 12:06:30 2019 +0200
Branches: master
https://developer.blender.org/rB0091b84df0281c44c98194cf94af7e894ff990e5

Fix T70268: Render failures with Vector pass active with OptiX in Cycles

Rendering would produce invalid results or crash if the Vector pass was active but motion blur was inactive. This caused the OptiX BVH to be built with motion (because objects reported motion available), but the pipeline to be built without motion support (since with disabled motion blur this is not in the list of requested features). The two are not compatible and therefore caused issues. This patch fixes that by not building the BVH with motion if motion blur is not active (which makes sense).

Reviewed By: brecht

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

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

M	intern/cycles/device/device_optix.cpp

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

diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp
index b745235aed5..6f4734059da 100644
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@ -169,6 +169,7 @@ class OptiXDevice : public Device {
   OptixModule optix_module = NULL;
   OptixPipeline pipelines[NUM_PIPELINES] = {};
 
+  bool motion_blur = false;
   bool need_texture_info = false;
   device_vector<SbtRecord> sbt_data;
   device_vector<TextureInfo> texture_info;
@@ -337,7 +338,12 @@ class OptiXDevice : public Device {
 #  endif
     pipeline_options.pipelineLaunchParamsVariableName = "__params";  // See kernel_globals.h
 
-    if (requested_features.use_object_motion) {
+    // Keep track of whether motion blur is enabled, so to enable/disable motion in BVH builds
+    // This is necessary since objects may be reported to have motion if the Vector pass is
+    // active, but may still need to be rendered without motion blur if that isn't active as well
+    motion_blur = requested_features.use_object_motion;
+
+    if (motion_blur) {
       pipeline_options.usesMotionBlur = true;
       // Motion blur can insert motion transforms into the traversal graph
       // It is no longer a two-level graph then, so need to set flags to allow any configuration
@@ -872,7 +878,7 @@ class OptiXDevice : public Device {
 
         size_t num_motion_steps = 1;
         Attribute *motion_keys = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
-        if (mesh->use_motion_blur && motion_keys) {
+        if (motion_blur && mesh->use_motion_blur && motion_keys) {
           num_motion_steps = mesh->motion_steps;
         }
 
@@ -942,7 +948,7 @@ class OptiXDevice : public Device {
 
         size_t num_motion_steps = 1;
         Attribute *motion_keys = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
-        if (mesh->use_motion_blur && motion_keys) {
+        if (motion_blur && mesh->use_motion_blur && motion_keys) {
           num_motion_steps = mesh->motion_steps;
         }
 
@@ -1041,7 +1047,7 @@ class OptiXDevice : public Device {
         instance.visibilityMask = (ob->mesh->has_volume ? 3 : 1);
 
         // Insert motion traversable if object has motion
-        if (ob->use_motion()) {
+        if (motion_blur && ob->use_motion()) {
           blas.emplace_back(this, "motion_transform");
           device_only_memory<uint8_t> &motion_transform_gpu = blas.back();
           motion_transform_gpu.alloc_to_device(sizeof(OptixSRTMotionTransform) +



More information about the Bf-blender-cvs mailing list