High Resolution Camera Snapshot == Poster Function == Tilt Shift Camera

I use Unity 3d for quick architectural visualizations. Sometimes the level of detail would allow a high resolution image but I am limitated by the graphic card. Following script saves still images while playing.

if (Input.GetKeyDown(“c”))
{
var name = String.Format(“{0}/{1:smile:04} shot.png”, realFolder, Time.frameCount );
// name is “realFolder/frameCountxxxx shot.png”
Application.CaptureScreenshot (name);
}

Is there a way to save 4, 9 or 16 images that fit together like one big poster?
This probably means that I need a function that zooms AND shifts the projection plane of the camera.

The principle is shown here: Tilt–shift photography - Wikipedia

Of course, it’s important to get distortion free parts of the original image. After 4, 9 or 16 “moves and captures”, the camera would be back at the original position. . . A tilt-shift camera would be great! Thank you!

Hi,

Have a look on this thread http://forum.unity3d.com/threads/6465-large-screenshots-for-print

Hope this helps… :slight_smile:

I guess, you don’t need the ‘tilt’ lens function, since that is for control the depth of field.

BTW. this is the function for ‘shift’ lens.

private var atan = Mathf().Atan;
private var tan = Mathf().Tan;
private var d2r = Mathf().Deg2Rad;

function view_control(c0:Camera, shearing:Vector2):Matrix4x4
{
var fov:float = c0.fieldOfView*d2r;
var aspect : float = c0.aspect;
var far:float = c0.farClipPlane;
var near:float = c0.nearClipPlane;

fov = atan(tan(fov/2.0)/2.0)*2.0;

var M:Matrix4x4 = Matrix4x4.zero;
M[0,2] = shearing.x;
M[1,2] = shearing.y;
M[1,1] = 1.0/tan(fov0.5);
M[0,0] = M[1,1]/aspect;
M[2,2] = -( far+near)/(far-near);
M[2,3] = -(2
far*near)/(far-near);
M[3,2] = -1.0;

return M;
}

How to use:
Camera.main.projectionMatrix = view_control(Camera.main, Vector2(0,1)); // please try different value on x or y to see the effect.

plus.
Camera.main.ResetProjectionMatrix() for resume the camera matrix back to normal projection.

Have Fun !

Thank you so much ! This sounds very promising. I’ll let you know. . .

Oopppss… I am wrong, please delete the following line.

fov = atan(tan(fov/2.0)/2.0)*2.0;

Sorry I forget to delete that, after I copy the code from my other project. That is used for some other purpose :wink:

Also, that should be very easy for multi-camera setup too.

3 cameras at the same location and the shearing value of y-axis are set to 0, 2 and 4 accordingly. It is work for any field of view value.

Great, also works w/lens effencts!

BUT with ANTI ALIAS, shaddows shear away from the scene. (E.g. when the image shears up, the shaddows shear down.

With AA, my image flips. I use a function to flip it back;
( http://www.unifycommunity.com/wiki/index.php?title=InvertCamera ).
However this is not “directly” the problem, because:
(a) shaddows do not appear flipped but sheared away
(b) if I turn off the flip back function, same effect. . .