diff --git a/intern/cycles/scene/camera.cpp b/intern/cycles/scene/camera.cpp index e53eafb8fff..7ef7bd6729c 100644 --- a/intern/cycles/scene/camera.cpp +++ b/intern/cycles/scene/camera.cpp @@ -395,7 +395,7 @@ void Camera::update(Scene *scene) /* depth of field */ kcam->aperturesize = aperturesize; - kcam->focaldistance = focaldistance; + kcam->focaldistance = max(focaldistance, 1e-5f); kcam->blades = (blades < 3) ? 0.0f : blades; kcam->bladesrotation = bladesrotation; diff --git a/source/blender/blenkernel/intern/camera.cc b/source/blender/blenkernel/intern/camera.cc index 7c39038c8bf..b1d9f78138f 100644 --- a/source/blender/blenkernel/intern/camera.cc +++ b/source/blender/blenkernel/intern/camera.cc @@ -290,9 +290,9 @@ float BKE_camera_object_dof_distance(const Object *ob) ob->object_to_world().location(), cam->dof.focus_object->object_to_world().location()); } - return fabsf(dot_v3v3(view_dir, dof_dir)); + return fmax(fabsf(dot_v3v3(view_dir, dof_dir)), 1e-5f); } - return cam->dof.focus_distance; + return fmax(cam->dof.focus_distance, 1e-5f); } float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)