Chrome issue with Create Screenshot Using Render Target

We are encountering a weird issue with Chrome when trying to use BABYLON.ScreenshotTools.CreateScreenshotUsingRenderTargetAsync.

PG Link: https://playground.babylonjs.com/#A2FPKU#3

This is what we found during testing:
Windows

  • Chrome (No AA) - Blank screenshot with no rendered model, but has the correct clear color.
  • Chrome (AA) - Blank screenshot with no rendered model and does not have the correct clear color.
  • Firefox (No AA & AA) - Working as intended
  • Edge behaves the same as Chrome (obviously)

Mac

  • Chrome (No AA) - Blank screenshot with no rendered model, but has the correct clear color.
  • Chrome (AA) - Blank screenshot with no rendered model and does not have the correct clear color.
  • Firefox (No AA & AA) - Working as intended
  • Safari (No AA & AA) - Working as intended (although only one screenshot will get downloaded at a time, so one of the calls needs to be commented out. I suspect it’s a browser limitation).

Chrome (No AA) can be fixed by introducing a small delay using setTimeout. We have not found anyway to fix Chrome (AA).

cc @sebavan (please be patient as seb is on vacation)

1 Like

You should wait for the scene to be ready before taking screenshots:

There’s a bug when setting antialiasing=true which will be fixed by:

In the meantime, you can use MSAA samples instead of antialiasing (which should be better, anyway):

2 Likes

@Evgeni_Popov I think we will switch to using MSAA samples for now. Thanks for the PG snippets! They were very helpful.