Fix T61857 Eevee DOF not working if the camera is in orthographic mode

It was just a bad mapping of the ogl depth to scene linear depth.
This commit is contained in:
Clément Foucault 2019-03-15 22:14:42 +01:00
parent efdde88dfc
commit fe40e184a6
Notes: blender-bot 2023-02-14 03:36:37 +01:00
Referenced by issue #61857, Eevee dephth of field not working if the camera is in orthographic mode.
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ uniform vec2 nearFar; /* Near & far view depths values */
#define linear_depth(z) ((ProjectionMatrix[3][3] == 0.0) \
? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) \
: (z * 2.0 - 1.0) * nearFar.y)
: z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */
#define weighted_sum(a, b, c, d, e) (a * e.x + b * e.y + c * e.z + d * e.w) / max(1e-6, dot(e, vec4(1.0)));