Render: Clamp minimum DOF focus distance

Clamp DOF focus distance to a minimum of 1e-5.
This is to primarily stop focus distances of 0 being used
which would lead to issues in future code changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/123310
This commit is contained in:
Alaska
2024-06-17 17:42:38 +02:00
committed by Brecht Van Lommel
parent 8ce5c2d8cb
commit 274da96722
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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)