From 04fa0511ca5ec305356a6060b25e2845053d62d6 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Wed, 22 May 2019 15:22:10 +0200 Subject: DrawEngines: Depth Of Field Units The unit system is designed for displaying and editing and not for rendering. Eevee, Workbench and GPencil used these settings to convert the focal length and sensor size to world units. Making depth of field render differently with Cycles. For now we will remove the scale in the draw engines to match cycles, until we implemented a camera parameters specific scale. Reviewed By: brecht, fclem Maniphest Tasks: T64988 Differential Revision: https://developer.blender.org/D4925 --- source/blender/draw/engines/eevee/eevee_depth_of_field.c | 9 +-------- source/blender/draw/engines/gpencil/gpencil_shader_fx.c | 8 +------- source/blender/draw/engines/workbench/workbench_effect_dof.c | 10 +--------- 3 files changed, 3 insertions(+), 24 deletions(-) (limited to 'source/blender/draw') diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index ae8e7614302..c14f08857c3 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -140,14 +140,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), float focus_dist = BKE_camera_object_dof_distance(camera); float focal_len = cam->lens; - /* this is factor that converts to the scene scale. focal length and sensor are expressed in - * 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; + const float scale_camera = 0.001f; /* we want radius here for the aperture number */ float aperture = 0.5f * scale_camera * focal_len / fstop; float focal_len_scaled = scale_camera * focal_len; diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c index d46e850ba82..5d3944e34f0 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c +++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c @@ -119,13 +119,7 @@ static void GPENCIL_dof_nearfar(Object *camera, float coc, float nearfar[2]) float focus_dist = BKE_camera_object_dof_distance(camera); float focal_len = cam->lens; - /* This is factor that converts to the scene scale. focal length and sensor are expressed in 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->unit.system) ? scene->unit.scale_length : 1.0f; - float scale_camera = 0.001f / scale; + const float scale_camera = 0.001f; /* we want radius here for the aperture number */ float aperture_scaled = 0.5f * scale_camera * focal_len / fstop; float focal_len_scaled = scale_camera * focal_len; diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index 6886b73650c..e24536759db 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -231,7 +231,6 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera) { const DRWContextState *draw_ctx = DRW_context_state_get(); - const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); RegionView3D *rv3d = draw_ctx->rv3d; /* Parameters */ @@ -242,14 +241,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera) float focal_len = cam->lens; /* TODO(fclem) deduplicate with eevee */ - - /* this is factor that converts to the scene scale. focal length and sensor are expressed in 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; + const float scale_camera = 0.001f; /* we want radius here for the aperture number */ float aperture = 0.5f * scale_camera * focal_len / fstop; float focal_len_scaled = scale_camera * focal_len; -- cgit v1.2.3