From c4d413fdadd9c46a2b00a9cc1e8065cd1ce4db8b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 31 May 2024 15:53:12 +0200 Subject: [PATCH] Fix: Cycles assert when having volumes and objects with displacement Delay calculation of volume step until bounds are known, avoiding access to non-valid bounds and fixing assert in debug builds. This seems to be an oversight from the #121042 Pull Request: https://projects.blender.org/blender/blender/pulls/122549 --- intern/cycles/scene/object.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/intern/cycles/scene/object.cpp b/intern/cycles/scene/object.cpp index bec2c23e9d2..ac5266f47c2 100644 --- a/intern/cycles/scene/object.cpp +++ b/intern/cycles/scene/object.cpp @@ -882,11 +882,17 @@ void ObjectManager::device_update_flags( bool has_volume_objects = false; foreach (Object *object, scene->objects) { if (object->geometry->has_volume) { + /* If the bounds are not valid it is not always possible to calculate the volume step, and + * the step size is not needed for the displacement. So, delay calculation of the volume + * step size until the final bounds are known. */ if (bounds_valid) { volume_objects.push_back(object); + object_volume_step[object->index] = object->compute_volume_step_size(); + } + else { + object_volume_step[object->index] = FLT_MAX; } has_volume_objects = true; - object_volume_step[object->index] = object->compute_volume_step_size(); } else { object_volume_step[object->index] = FLT_MAX;