Screenshot results in bad DOF

Hi guys, can’t seem to figure out why I’m getting this odd behavor.

This is how it looks using CreateScreenshotUsingRenderTargetAsync:

This is how it looks in game:

If I set the width/height of the screenshot to the game width/height, the DOF artifacts go away.

Would you be able to setup a simplified repro in the Playground (just the starter scene with a DOF post process and taking a screenshot with CreateScreenshotUsingRenderTargetAsync)? That would help debugging the problem.

https://playground.babylonjs.com/#4YBB22#1

Rotate the camera and let go of the mouse to take a screenshot.

It’s pretty clear in this example that the DOF mapping is stretched according to the difference between the aspect of the canvas and the screenshot.

You can fix the problem by setting the engine sizes to the sizes of the screenshot:

https://playground.babylonjs.com/#4YBB22#5

However, this does not work in WebGPU because it seems the size of the canvas can’t be changed anytime we want (don’t know if it’s something expected or a bug from Chrome that will be fixed when WebGPU is live)… Pinging @sebavan in case he has some ideas.

Nope, unfortunately none :frowning: let s check on our next Chrome Sync.