Screenshot with transparent BG

Hey all,

Two questions… I snagged some script from this project: PlayCanvas 3D HTML5 Game Engine

I’ve been able to re-create saving a screen shot, however, I need my background to be transparent instead of the canvas ‘gray’ that comes in as default. Any suggestions on how to get the bg to be transparent?

Second, why am I not able to do the following to capture what’s currently being rendered on the screen? When I do, it’s just a blank screenshot.

var canvas = document.getElementById('application-canvas');
data = canvas.toDataURL('image/png');

Please use the official project from PlayCanvas here: Capturing a screenshot | Learn PlayCanvas

If you need a transparent background, then the clear color on the camera for the screenshot needs to have an alpha value of 0

1 Like