Is it possible to take screenshots from a camera and not from the canvas. In your playcanvas tutorials, you use the canvas to make the screenshot.
We want to take screenshots from another camera that is not the main camera, is that possible? so that a camera would just that screenshots in the background and not be the rendered camera on the canvas.
to make a screenshot i would have to make an image element to have a png. So how can a turn my texture to an image element.
Because in my project, when you click on the button it takes multiple screenshots from different cameras and downloads them directly on my computer. Additionally we want to change the resolution of the screenshot to a 3300 x 3300.
var canvas = document.getElementById('application-canvas');
var dataURL = canvas.toDataURL('image/png');
var image = new Image();
image.src = dataURL;
// put the right link in the <a> and take the shot
this.button.href = dataURL;
this.button.download = "screenshot.png";
this is my code, but in our case, we don’t want the canvas to make the screenshot, but a camera that is not the main cam. and to be able to change the resolution of the image, but I am having doubts that it’s possible, because the downloaded image is the one from the dataUrl and i doubt we can change the size.
For now, we disable and enable different cameras to have different screenshots, but we see the change in the canvas, and that is not what we want.
Actually trying this now and it’s a lot more difficult than I first thought as I can’t seem to convert a texture to something I can create an image out of yet.
However, as a work around, could you add a HTML DOM object/image to the screen that covers the canvas, enable/disable the cameras to take the screenshots from the canvas and when it’s all done, enable the main camera and remove the DOM?
Building on top of this solution: Instead of setting the renterTaget of a layer to the texture, you can directly set the renderTarget of the screenshot camera to the texture. Then you don’t have to create another layer and tag every object you want to see in the screenshot.
(I would have commented directly on the demo project, but the devlog is empty, so I can’t.)