#7051·openscad

No way to set the camera field of view from the command line

Author: whosawhatsisCreated Sep 18, 2026Updated Sep 18, 2026

Problem

There is no command-line option that sets the camera's field of view, and the one indirect route is closed off:

  • --camera takes 7 numbers (translate_x,y,z,rot_x,y,z,dist) or 6 (eye_x,y,z,center_x,y,z). Neither form carries the FOV.
  • $vpf can set it from the design — but only while the camera is unlocked. Camera::updateView() returns immediately when locked is set, and Camera::setup() sets locked for exactly the --camera case.

So as soon as an image export names a camera, the field of view is pinned at the 22.5 degree default and nothing can change it.

This is not only about perspective: GLView::setupCamera() derives the orthographic half-height as distance * tan(fov / 2), so under --projection=ortho the FOV sets the scale of the view. A command-line ortho render is therefore stuck at one zoom-per-distance ratio as well.

To reproduce

$ cat fov.scad
echo($vpf=$vpf);
cube(10);

$ openscad -o out.echo fov.scad --camera 0,0,0,55,0,25,140
ECHO: $vpf = 22.5

$ cat fov2.scad
$vpf = 60;
echo($vpf=$vpf);
cube(10);

$ openscad -o out.echo fov2.scad --camera 0,0,0,55,0,25,140
ECHO: $vpf = 60          # the design's value, but the render still uses 22.5

The second case is the confusing one: the design reports 60, and the exported PNG is rendered at 22.5.

The repository's own fixtures show the same thing — tests/regression/echo-cli-view-variables-6/test-view-variables-expected.echo and -7/ both expect ECHO: $vpf = 22.5 whatever camera arguments the test passes.

Expected

Some way to set the field of view for an image export from the command line, consistent with every other gimbal camera parameter being settable.

Suggested fix

A --fov=<degrees> option applied next to --camera/--projection/--imgsize. An alternative would be an optional 8th number on --camera, though that does not compose with the 6-number vector camera form. Happy to open a PR for whichever is preferred.

Version

Reproduced on master (1c9ee2b).