Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-04-15 17:17:21 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-04-15 17:24:19 +0300
commit6bc2ba21117a25c8a7100b282cc2377e1adf7075 (patch)
tree9b25f4211a014817742f60c09e83231e02635b43 /source/blender/gpu/intern
parent3165e8740b83f28569a9e405757f4c34c378df3b (diff)
Fix T48157: 3D view's depth of field isn't displayed correctly with scene units scale.
focus distance is given in BU, no need to scale it at all.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_compositing.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 7534d9d0fb9..c2a2b1804ca 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -871,14 +871,15 @@ bool GPU_fx_do_composite_pass(
float scale = scene->unit.system ? scene->unit.scale_length : 1.0f;
/* 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. */
+ * 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_camera = 0.001f / scale;
/* we want radius here for the aperture number */
float aperture = 0.5f * scale_camera * fx_dof->focal_length / fx_dof->fstop;
dof_params[0] = aperture * fabsf(scale_camera * fx_dof->focal_length /
- ((fx_dof->focus_distance / scale) - scale_camera * fx_dof->focal_length));
- dof_params[1] = fx_dof->focus_distance / scale;
+ (fx_dof->focus_distance - scale_camera * fx_dof->focal_length));
+ dof_params[1] = fx_dof->focus_distance;
dof_params[2] = fx->gbuffer_dim[0] / (scale_camera * fx_dof->sensor);
dof_params[3] = fx_dof->num_blades;