mirror of
https://projects.blender.org/blender/blender.git
synced 2025-01-22 15:32:15 -05:00
Fix #123249: Orthographic DOF is influenced by near clip
Fix an issue where the DOF distance in orthographic mode is specified distance + near clip distance, which can lead to unpredicable results. Pull Request: https://projects.blender.org/blender/blender/pulls/123267
This commit is contained in:
parent
274da96722
commit
08cc73a9bb
Notes:
blender-bot
2024-11-20 05:37:23 +01:00
Referenced by pull request #123341, Fix #123324: Improve Cycles camera bounding box size calculation
Referenced by issue #123324, Cycles: Interior of volumes sometimes do not render properly in orthographic mode
Referenced by pull request #130500, Tests: Add render test for Orthographic camera with DOF with far nearclip
Referenced by commit 60bf09e8db
, Tests: Add render test for Orthographic camera with DOF with far nearclip
3 changed files with 7 additions and 7 deletions
|
@ -186,13 +186,16 @@ ccl_device void camera_sample_orthographic(KernelGlobals kg,
|
|||
/* compute point on plane of focus */
|
||||
float3 Pfocus = D * kernel_data.cam.focaldistance;
|
||||
|
||||
/* update ray for effect of lens */
|
||||
/* Update ray for effect of lens */
|
||||
float3 lens_uvw = float2_to_float3(lens_uv);
|
||||
P = Pcamera + lens_uvw;
|
||||
|
||||
D = normalize(Pfocus - lens_uvw);
|
||||
/* Compute position the ray will be if it traveled until it intersected the near clip plane.
|
||||
* This allows for correct DOF while allowing near cliping. */
|
||||
P = Pcamera + lens_uvw + (D * (kernel_data.cam.nearclip / D.z));
|
||||
}
|
||||
else {
|
||||
P = Pcamera;
|
||||
P = Pcamera + make_float3(0.0f, 0.0f, kernel_data.cam.nearclip);
|
||||
}
|
||||
/* transform ray from camera to world */
|
||||
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
||||
|
|
|
@ -190,8 +190,7 @@ ccl_device_inline ProjectionTransform projection_perspective(float fov, float n,
|
|||
|
||||
ccl_device_inline ProjectionTransform projection_orthographic(float znear, float zfar)
|
||||
{
|
||||
Transform t = transform_scale(1.0f, 1.0f, 1.0f / (zfar - znear)) *
|
||||
transform_translate(0.0f, 0.0f, -znear);
|
||||
Transform t = transform_scale(1.0f, 1.0f, 1.0f / (zfar - znear));
|
||||
|
||||
return ProjectionTransform(t);
|
||||
}
|
||||
|
|
|
@ -93,8 +93,6 @@ void DepthOfField::sync()
|
|||
if (camera.is_orthographic()) {
|
||||
/* FIXME: Why is this needed? Some kind of implicit unit conversion? */
|
||||
aperture *= 0.04f;
|
||||
/* Really strange behavior from Cycles but replicating. */
|
||||
focus_distance_ += camera.data_get().clip_near;
|
||||
}
|
||||
|
||||
if (camera.is_panoramic()) {
|
||||
|
|
Loading…
Reference in a new issue