Fix swapped vertical frustum bounds for cameras with principal point offset.

The frustum_top and frustum_bottom assignments in mjv_updateCamera used
the wrong elements of the zver array, causing the principal point cy
offset to be applied with an inverted sign. This shifted the rendered
image vertically by 2*cy pixels.
This commit is contained in:
Kevin Zakka
2026-03-04 01:03:55 -08:00
parent a06c091157
commit 77ce80bc63
2 changed files with 48 additions and 2 deletions
+2 -2
View File
@@ -2910,8 +2910,8 @@ void mjv_updateCamera(const mjModel* m, const mjData* d, mjvCamera* cam, mjvScen
scn->camera[view].orthographic = orthographic;
// set symmetric frustum using intrinsic camera matrix
scn->camera[view].frustum_top = zver[1];
scn->camera[view].frustum_bottom = -zver[0];
scn->camera[view].frustum_top = zver[0];
scn->camera[view].frustum_bottom = -zver[1];
scn->camera[view].frustum_center = (zhor[1] - zhor[0]) / 2;
scn->camera[view].frustum_width = (zhor[1] + zhor[0]) / 2;
scn->camera[view].frustum_near = zclip[0];