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:

  1. The Camera alt text

  2. This solution wouldn't work as each camera has it's own perspective rather than that portion of the base cameras projection. alt text

  3. 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. alt text

alt text

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:

http://www.dukecg.net/TiledScreenCapture.unitypackage

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

img

You can tile orthographic cameras like #1 but then there will be no perspective.

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?

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.