[Feature request] Depth of field through transparent ray traced reflections

Hi,

I’m working with a couple of cinematics that involve ray traced glass and depth of field. Currently, depth of field is lost after enabling “Receive SSR Transparent”.

I would like to suggest support for depth of field through transparent ray traced reflections.

Thanks,
m0nsky

Examples:

Hey, thanks for bringing that up.

First, receive transparent SSR force a depth pre pass by default so the problem seems to be coming from that. And it seems to have nothing to do with SSR itself, nor raytracing (the same happens with classic version)

I did investigate a little bit and what’s surprising is that it seems to be working as expected when the transparent in in the near blur, but not in the far blur. The two should technically behave the same way.

I’ll poke a few people and see if there’s something to do about it.

3 Likes

The weird thing is, it does work after disabling SSR/RTR (or setting the Rendering Pass to “Low resolution”)

However, there won’t be sharp reflections on the glass itself (which you would expect?)

This is kind of expected because SSR on transparent forces transparent to write their depth, so it’s related but indirectly.

In HDRP, one pixel can only have one depth, so either, so you let transparents and they inhenrit the depth from what’s behind them (cubemap or geometry), or force them to write their depth but what’s behind the transparent will also have the same depth, so there’s no perfect solution here.

The reason why “it works” it the low resolution transparent pass, is that low resolution transparent pass never write their depth and they are rendered later in the pipeline so they cannot receive SSR either.

However, there’s two hacky workaround for your cases:

  • Use Pathtracer with Depth Of Field with Focus Mode property in Physical Camera. That way, the Depth Of Field is also path traced (not rendered as a post process), which should gives the proper result. But that doesn’t really work for realtime situation.
  • Use HDRP Compositor with multiple layers. That way, you could manage your background and foreground separately. That should give you more flexibility about what to blur and what not to blur.
2 Likes

Thanks for the detailed explanation @chap-unity , I’m not sure if the compositor would work for this. For now I’ll stick to the following:

Desktop : DoF + no transparent SSR
VR : no DoF + transparent SSR

Would love to see this working as intended in the future, I think more people are going to be running into this.

1 Like

just a random unqualified thought
Maybe it’s possible to use traveled distance of those transparent-reflective rays as some kind of depth override for those transparent pixels?