Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_depth_of_field.c
| Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) { | ||||
| float fstop = cam->dof.aperture_fstop; | float fstop = cam->dof.aperture_fstop; | ||||
| float blades = cam->dof.aperture_blades; | float blades = cam->dof.aperture_blades; | ||||
| float rotation = cam->dof.aperture_rotation; | float rotation = cam->dof.aperture_rotation; | ||||
| float ratio = 1.0f / cam->dof.aperture_ratio; | float ratio = 1.0f / cam->dof.aperture_ratio; | ||||
| float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); | float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); | ||||
| float focus_dist = BKE_camera_object_dof_distance(camera); | float focus_dist = BKE_camera_object_dof_distance(camera); | ||||
| float focal_len = cam->lens; | float focal_len = cam->lens; | ||||
| /* this is factor that converts to the scene scale. focal length and sensor are expressed in | const float scale_camera = 0.001f; | ||||
| * mm unit.scale_length is how many meters per blender unit we have. We want to convert to | |||||
| * blender units though because the shader reads coordinates in world space, which is in | |||||
| * blender units. | |||||
| * Note however that focus_distance is already in blender units and shall not be scaled here | |||||
| * (see T48157). */ | |||||
| float scale = (scene_eval->unit.system) ? scene_eval->unit.scale_length : 1.0f; | |||||
| float scale_camera = 0.001f / scale; | |||||
| /* we want radius here for the aperture number */ | /* we want radius here for the aperture number */ | ||||
| float aperture = 0.5f * scale_camera * focal_len / fstop; | float aperture = 0.5f * scale_camera * focal_len / fstop; | ||||
| float focal_len_scaled = scale_camera * focal_len; | float focal_len_scaled = scale_camera * focal_len; | ||||
| float sensor_scaled = scale_camera * sensor; | float sensor_scaled = scale_camera * sensor; | ||||
| if (rv3d != NULL) { | if (rv3d != NULL) { | ||||
| sensor_scaled *= rv3d->viewcamtexcofac[0]; | sensor_scaled *= rv3d->viewcamtexcofac[0]; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines | |||||