How to take a screenshot of a fixed aspect ratio in the scene

@yaustar

Hi!

Regarding this topic i have a question im currently trying to find a solution for:

In an 3D scene i want to capture an area and create an image from this area (its like a photo booth). The image always should have the same size and the same scene detail - like a photo booth.

Now i tried the screenshot scenes - but when switching to mobile it stretches the output.

Is there a solution i could place a fix photo booth camera and some kind of area to create a screenshot from?

if using the screenshot example with the ui screenshot area, it wount work, because it always adjusts the resolution, if switching on mobile device resolutions and standalone.

Basically it should be always the same picture of the photo booth area - regardless if on mobile or standalone. its not like taking just an camera screenshot, because its resolution also changes depending on the device resolution - it just should always be a fix frame / covering the same area of the 3d Scene.

Not sure how to achieve this

If you’re using engine 2, we have this new function that could work for your case:

It’s not public yet, but will work fine.
Just allocate a color texture with resolution you need, create a render target using it as a color buffer, attach it as a render target on the camera. Then enable the camera for a frame, and in the following frame you can call Texture.read, which gives you a promise to get the data back in a frame or two later.

Hi @mvaligursky no this project is not using Engine v2.

Would you have an idea how to achieve this within Engine v1?

consider moving the project to v2.

on v1, what you have is probably one of the easiest to do solutions, unless you want to go down to webgl code yourself. But after you download the image, you might need to crop it based on the screen aspect ratio or similar, to have the same view.

Thanks a lot…

hmm i think i will have to create some kind of workaround and adjust the fov for the different platforms.

I think adjusting the fov should work - but its a quick and dirty workaround…