Maniphest T80972

Eevee loses DoF function (while Cycles works just fine)
Closed, Archived

Assigned To
Richard Antalik (ISS)
Authored By
Bo Maryniuk (isbm)
Sep 19 2020, 8:54 PM
Tags
  • BF Blender
Subscribers
Bo Maryniuk (isbm)
Firepal64
Richard Antalik (ISS)

Description

System Information
Operating system: MacOSX 10.15.2
Graphics card: Radeon RX Vega 56 8 GB (eGPU)

Blender Version
Broken: Radeon RX Vega 56 8 GB

Short description of error
I have two images as planes with movie clips in them, both with alpha, aligned by Y axis. Camera looks at first, other as a background. When I wanted to add DoF so the background is blurred, I found that camera cannot do Depth of Field at all and blurs all objects at the same time orall objects are sharp.

NOTE: this happens only in Eevee, Cycles works fine.

Exact steps for others to reproduce the error

Fully reproducible:

  1. Add an image as a plane, make it big, put away enough. Let's call it image A.
  2. Add a mesh cone.
  3. Make camera look at the cone's tip and let the image as a plane be at background image A visible
  4. Make DoF tareging cone so the cone is crisp, back image A is blurred just as expected.
  5. Add another image B as plane at the same distance as cone, but the image B is the same blurred as the background A.

If you switch to Cycles, all works as expected.

Event Timeline

Bo Maryniuk (isbm) created this task.Sep 19 2020, 8:54 PM
Bo Maryniuk (isbm) updated the task description.Sep 19 2020, 9:20 PM
Firepal64 added a subscriber: Firepal64.Sep 22 2020, 11:59 PM

is Alpha Blend enabled on the planes' materials, perhaps?

Alpha Blend will prevent the material from rendering in the depth buffer, and the DoF depends on it.
Use Alpha Hashed or Opaque, depending on your direct use-case for image-as-planes.

Bo Maryniuk (isbm) added a comment.Sep 23 2020, 9:54 PM

Right, the image/video must have alpha. I think can be closed, I figured it out myself actually. So if I put it as Alpha Hashed then it works just fine. No idea what is the difference between Alpha Blend and Alpha Hashed though.

Firepal64 added a comment.Sep 23 2020, 11:25 PM

Glad that fixed it!

In T80972#1021905, @Bo Maryniuk (isbm) wrote:

No idea what is the difference between Alpha Blend and Alpha Hashed though.

Let me explain the different "Alpha modes" Blender provides:


Alpha Blend uses native GPU "blending" functionality. Triangles that use blending are rendered separately, and then mixed on top of the rest of the render, inside of the GPU. Blending is pretty fast to render on modern hardware and is a good approximation of proper transparency, but has a few problems. For example, it is impossible to know the depth of a "blended" triangle and a regular triangle at the same time with a single depth image. Regular triangles have special priority in this regard.


Alpha Clip uses native GPU "pixel discarding" functionality. Any pixel on a triangle that uses Alpha Clip can be either fully opaque or fully transparent in this mode. This is the least visually-pleasing Alpha mode Blender provides, but unlike Alpha Blend, depth is fully preserved in this mode.


Alpha Hashed uses a modified variant of "Alpha Clip". Long story short, a noise texture is placed onto the mesh and used for Alpha Clip. On every render sample, the noise is randomized.

This emulates the transparency method from a ray-traced rendering engine like Cycles. A good few samples are needed to average out the noise, but Alpha Hashed is the most accurate transparency method you'll find here.

i should try contributing to blender someday

Bo Maryniuk (isbm) added a comment.Sep 26 2020, 1:56 PM

@Firepal64 very nice explanation, thank you very much! (I haven't expected it, TBH). Yeah, it also explains why keyed-out hair looks horrid with Alpha Clip and the only way to let hair look naturalistic is to use Alha Hashed. Somewhat I was always thinking that I do keying wrong, but apparently that's why. However, then the whole clip sometimes is transparent in few places, so I have to always cheat by placing perimeter-masked/shrinked Alpha Clip right behind it to get much more forgiving results. :-) Thank you very much!

Bo Maryniuk (isbm) added a comment.Sep 26 2020, 3:19 PM

@Firepal64 but since we are already talking about this topic, there is another related little nitpick I found, which is sort of forgiving, but not always. See, in Eevee, if the focus us point Image as a Plane with Alpha set to hashed (to get it sharp and everything else blurred), yet while all DoF'ed 3D objects are gets blurred properly, still they their edges are razor sharp as long as they overlap the visible parts of Alpha image, and are properly blurred if they are overlapping over transparency of that Alpha image. However, if I set Plane to Alpha Clip, DoF is blurred correctly (but then the image as a plane itself gets then out of focus). Is there any way to fix that or Eevee is too limited at this point?

Firepal64 added a comment.Sep 26 2020, 3:39 PM

You're welcome! =)

In T80972#1023987, @Bo Maryniuk (isbm) wrote:

if I set Plane to Alpha Clip, DoF is blurred correctly (but then the image as a plane itself gets then out of focus).

I can't replicate that. I tried Alpha Hashed and Alpha Clip and I don't see a difference.
What Blender version do you use? Can you share a blend file that shows this, maybe?

(Are you perhaps referring to the background DoF blur bleeding onto the foreground?)

Firepal64 added a comment.Sep 26 2020, 3:43 PM

Also, I guess this task can be marked as "Invalid", since this is a (seemingly undocumented) known issue of EEVEE DoF.
But I'm not sure Users are allowed to do that x) *shrug*

Richard Antalik (ISS) closed this task as Archived.Sep 29 2020, 5:55 PM
Richard Antalik (ISS) claimed this task.
Richard Antalik (ISS) added a subscriber: Richard Antalik (ISS).
In T80972#1023994, @Firepal64 wrote:

But I'm not sure Users are allowed to do that x) *shrug*

I guess as long as you are correct, you can :) worst case, we can reopen report.

@Bo Maryniuk (isbm) next time please upload simple example file, this removes a lot of disambiguity from bugfixing process.