- Home /
Taking huge screenshots using camera array?
I posted this on the forums but that place is like a graveyard.
I'm sure you can do this - CryEngine has some mode where you can take a screenshot up to 28800x16200. This is probably achieved by taking tiled shots. I'm aware you can use a Render Texture to take a largish screenshot, but the drawback is anything else that is resolution dependent, like screen-space effects or mip-mapping are significantly degraded.
I can take a shot using a RT at 4961x3508 (A3 @ 300 dpi), but water reflections are still using their 256 textures, and loading the buffer up further than 4096 textures would kill it!
So yes, how would I go about doing this, manipulating a matrix so that i can grab an image in tiles while maintaining the perspective distortion?
Here's some images to demonstrate:
The Camera
This solution wouldn't work as each camera has it's own perspective rather than that portion of the base cameras projection.
This is the solution that would work - it shifts the project horizontally and vertically to get a portion of the whole, so that together it forms a coherent image with perspective. But I don't know how to set this up. The first top-left tile is tinted to make it clearer.
Here's my current progress. It's doing what I want in that if you put them together and scale them down, they match the output of a single camera. What's wrong is how i'm calculating their FOV and matrix offsets. The code is messy as hell:
Answer by _Petroz · Oct 26, 2010 at 04:23 AM
I don't think #3 will work either because the perspective of the camera which are off center will be different. Also the aspect ratio will be different. If this is possible using separate cameras I think it would be non-trivial.
http://www.freeimagehosting.net/uploads/7fcbe2b37c.png
You can tile orthographic cameras like #1 but then there will be no perspective.
I'm onto what I think is vertical/horizontal shift in the camera projection matrix - $$anonymous$$02 is the X shift and $$anonymous$$12 is the Y shift. it appears to shift the camera without breaking the perspective/center point. I'll post back when I get results.
Edited with my solution so far - i'd love some input on how to properly calculate the FOV/offsets. The relavent code is in ProjectionShiftController.InstantiateCameraArray()
Answer by Joshua 3 · Oct 26, 2010 at 02:00 PM
The way to create a tiled screenshot is to use the PerspectiveOffCenter function found here: http://unity3d.com/support/documentation/ScriptReference/Camera-projectionMatrix.html to create the projection matrix for the camera. Basically the left, right, bottom, top are the sides of each tile as in the graphic you provided.
I have gotten that working myself but unfortunately changing the projection matrix makes the shadows incorrect for me. see: http://answers.unity3d.com/questions/10071/off-centre-projection-matrix-breaks-cascaded-shadows
Once you get your tiling done can you post if your shadows work properly?
Answer by Herman-Tulleken · Oct 26, 2010 at 04:51 AM
What you could try is to put your camera far enough away, and then rotate it for each tile. This will give you some distortion (because you are essentially mapping a sphere to a plane), but it is worth a try to see how the result looks. The setup should be pretty simple: to make things easier, use a square resolution.
Then simply take the shots, something like this:
for(i = -k; i <= k; i++) { for (j = -k; j <= k; j++) { Quaternion rotation = Quaternion.Euler(camera.fov * i, camera.fov * j, 0); camera.transform.rotation = rotation;
images[i + k,j + k] = TakeScreenShot();
} }
StichTogether(images)
The stitch algorithm here need only place the images next to each other. The value 2*k+1 gives the number of tiles in each direction.
You might need to make certain objects invisible for your camera (so that you can put it far enough away to get a nice range).
Once you have this base case going, you can start playing with ideas to improve the result.
Your answer
![](https://koobas.hobune.stream/wayback/20220613080824im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Taking screenshot from a second camera 0 Answers
Wierd Screen Shot Problem, texture of screen shot looks different in editor and in system. 1 Answer
Problem with screenshot on render texture 0 Answers
Rendering screenshot using multiple cameras and one rendertexture 0 Answers
Camera.RenderWithShader not working as of Unity 5.3? 0 Answers