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;
GraphicsRow[{ImageAdjust[imga + imgb], ImageAdjust[imga - imgb]}, ImageSize -> 300]
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;
GraphicsRow[{ImageAdjust[imgc + imgd], ImageAdjust[imgc - imgd]}, ImageSize -> 300]
MinMax[imgc - imgd]
(* {-0.501961, 0.376471} *)
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)"
.
ImageSize
. Check withAbsoluteOptions
(in V13), and you will see that in the second case, theImageSize
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}];
$\endgroup$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. $\endgroup$Viewpoint
,ViewCentrer
andViewVector
? 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. $\endgroup$