# Converting ViewPoint and ViewCenter to ViewVector

In the documentation about ViewPoint in the section "Properties & Relations" we can read:

"Convert ViewPoint to ViewVector by multiplying the length and pointing the center:"

But the images are not exactly same, the first is bigger than second at first glance.

So is it a bug or do they themselves do not know how to convert ViewPoint and ViewCenter to ViewVector?

The code from the documentation page:

Graphics3D[{Sphere[], Cuboid[]}, ViewPoint -> {3, -3, 3}]
Graphics3D[{Sphere[], Cuboid[]},
ViewVector -> {2 {3, -3, 3}, {0, 0, 0}}]

• I think the difference is only in the ImageSize. Check with AbsoluteOptions (in V13), and you will see that in the second case, the ImageSize is slightly different. If you make it the same in both cases, you will get identical images: Graphics3D[{Sphere[], Cuboid[]}, ViewVector -> {2 {3, -3, 3}, {0, 0, 0}}, ImageSize -> {360, 360}]; Graphics3D[{Sphere[], Cuboid[]}, ViewPoint -> {3, -3, 3}, ImageSize -> {360, 360}]; Commented Sep 15, 2022 at 13:49
• No, they are not same, they may look like same, but try to rasterize both and compare image data. They are not equal. Commented Sep 15, 2022 at 13:56
• Ah, well, you are partly right. I was displaying them in a row, Row[{Graphics3D[...], Graphics3D[]}], in which case they are the same. Displayed separately, they are indeed not. Still, it looks like there is something about the margins/paddings, because they are not fundamentaly different (perspective-wise), only rescaled. Commented Sep 15, 2022 at 14:09
• We are using mathematical tool not artistic. I want exact matching pixel by pixel. What is the exact mathematical formula for relation between Viewpoint, ViewCentrer and ViewVector? What they claim about their relation in the documentation is incorrect. If it was correct the images must have been the same regarding comparing their image data. Commented Sep 15, 2022 at 14:17
• Strongly related, if not duplicates: (1), (2). Commented Sep 15, 2022 at 14:31

As I have already suspected in the comments, there does not seem to be a problem in the formula for conversion between ViewPoint and ViewVector because the output images are only scaled versions of one another, and the difference is only in the outer padding.

The problematic option seems to be SphericalRegion, which is set to Automatic by default. Apparently, using ViewPoint turns SphericalRegion to False, making the output graphics be cropped to the top and bottom edge.

Let's first omit specifying SphericalRegion. To make the output images of same size, ImageSize has to be set manually.

Quit[];
ClearSystemCache[];

\$Version
(* "12.3.1 for Microsoft Windows (64-bit) (June 24, 2021)" *)

a = Graphics3D[{Sphere[], Cuboid[]}, ViewVector -> {2 {3, -3, 3}, {0, 0, 0}},
ImageSize -> {300, 300}];
b = Graphics3D[{Sphere[], Cuboid[]}, ViewPoint -> {3, -3, 3},
ImageSize -> {300, 300}];

imga = Rasterize@a;
imgb = Rasterize@b;



Now specify SphericalRegion -> True.

Quit[];
ClearSystemCache[];

c = Graphics3D[{Sphere[], Cuboid[]}, ViewVector -> {2 {3, -3, 3}, {0, 0, 0}},
SphericalRegion -> True];
d = Graphics3D[{Sphere[], Cuboid[]}, ViewPoint -> {3, -3, 3},
SphericalRegion -> True];

imgc = Rasterize@c;
imgd = Rasterize@d;


Both results now match. Although they are indeed not pixel-perfectly matching, I would consider this to be the solution for your problem. The remaining differences are probably – in my opinion – due to small numerical "errors" in the underlying linear algebra for graphics (when using either ViewPoint or ViewVector), and subsequent rasterization.
Note: I get the very similar results also in "13.0.0 for Microsoft Windows (64-bit) (December 3, 2021)".
• But this just means that when ViewPoint and ViewCenter are used the algorithm to render output is different than algorithm used with ViewVector. If the algorithm was the same and inputs given with same precision there can not be any differences (the conversion between the two is just one multiplication and sometimes even without it when box width is 1). Then it has no much sense to explain how to convert between those two parameters if they do not state that it is just approximation - the more it is mathematical tool. Commented Sep 15, 2022 at 16:48