I am trying to make a 3D animation in Asymptote involving moving infinite surfaces. I would like to set up a "steady camera", so that a unit ball would always look the same size relative to the screen, no matter how far the surfaces actually extend beyond the screen.

However, it seems that after projecting, Asymptote automatically computes a bounding box that includes everything that is displayed, and then crops the picture to that box. If you change the "zoom" parameter (setting it for example to 10), you get a bounding box 1/10th that size; however, it still depends on what happens outside the screen.

Is there any way to specify a projection with a fixed viewport?

Here is a minimal working example:

import three;
import solids;
import animation;

animation A;

int n = 50; //number of steps
int m = 10; //step at which we reach "normal" size
for(int i=0; i<=n; ++i) {
  surface sphere = (scale3(i/m) * unitsphere);
  draw(sphere, gray+opacity(0.5));


When I compile it, the sphere moves around the screen first in a seemingly random fashion (it is not even centered!! why?), then constrained by the boundaries of the screen.

I would like the sphere to start in the center, hit the screen boundaries at frame 10 (on all sides at the same time), then keep growing past the screen boundaries (so that at the end only a small part of the sphere is visible.)

A possible workaround would be to write

draw(circle(O,100,camera), invisible);

and then to set zoom=100. But this does not look very clean, takes forever to render, and depends on being sure that no object will ever extend past the invisible circle.

  • Could you provide us with a MWE?
    – Markus
    Nov 6, 2014 at 8:30
  • Sure, here it is. Nov 6, 2014 at 12:07

1 Answer 1


A little bit too long to test and retest. perspective has some options : angle, showtarget, center, autoadjust.


currentprojection=perspective(6,6,6,angle=15,autoadjust=false, showtarget=false,center=true);

all spheres/zoom are well drawn but in an animation an error message occurs at i=40 : camera too closed.

So I tried


it seems to be ok. You just to adapt angle to have at i=10 what you want. But I do not know if it is possible to have "hit screen boudaries at i=10" and to reach i=50 without "camero too closed error message".


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .