Rotate Viewport Without Moving Camera?

Hi all,

I was wondering if USD has any functionality to simply rotate the viewport without moving the camera? Basically, my scene is a rotating object at the origin, and I would like the viewport to rotate to match the rotation of the scene while keeping the camera stationary in the world frame. I found that there is an xform op suffix called “camera_offset” which sort of gets me there, but is not quite sufficient just yet. Is there anywhere that I can find a more comprehensive list of suffixes for the camera xform, or does anyone have any advice on tackling this problem?

Any reason why you wouldn’t make a new “orbit” camera, and parent it under the transform that is rotating your object? Then your stationary camera is where you expect, and the orbit camera can match your turntable.

I ask, because I can’t think of a straight forward way to do what you propose. The viewing transform is derived from the camera’s transform…

+1 to what @nporcino said. I only wanted to add a clarification on xformOp suffixes… they are completely free-form and up to the author of the scene to decide, along with the sequence of xformOps present on any given prim. There may be conventions for naming certain ops that DCC’s agree on for certain functions, and that is great. UsdGeomXformCommonAPI uses the “pivot” suffix for the translate xformOp it uses for rotation pivots… that’s the only convention within the USD core, as far as I recall.

Thanks for the quick replies @nporcino @spiff! Sorry, the question was not well-posed since I didn’t quite understand what I was looking for. I now understand, and would like to restate the problem:

Basically, we want to recreate the effect of when an object is rotated, how it looks “warped.” I previously created a function to do this with the camera which moved the camera around the object and then applied the respective offsets. However, now I would like to instead rotate the object and calculate some way of setting the aperture attributes to essentially match the projection of the bounding box of my object onto the aperture plane if that makes sense

EDIT: I have attached a stage that can essentially do what I want although the method is very case-specific and so I would like to generalize it
rotate_warp.usda (5.4 MB)
camera has the requested effects applied

In the future when usd includes OpenExec, you would be able to have a setup where an object’s rotation and/or bounds could drive, through a connection and computation (if math is needed), the Camera’s aperture.

I’m afraid that’s a ways off, though.

Yeah that’s completely fair. I was able to hack something together but I’m having trouble getting the fine-tuning right and was wondering if I could get some advice? Kind of the same setup as before but the problem is slightly modified.

I have a camera that is offset around my scene, and then after the offset is applied I want to rotate the camera back to its original position so that the aperture is moved, but the camera is physically where it originally was. I am running into an issue with rotating it back, where it seems to just proceed along the arc instead of remaining in place…

Here is the code for the rotation:

        axes = [Gf.Vec3d(1, 0, 0), Gf.Vec3d(0, 1, 0), Gf.Vec3d(0, 0, 1)]

        t = cam_prim.ComputeLocalToWorldTransform(i).ExtractTranslation()
        # print(view_angles[i])
        # print(t/norm(t))

        # Get rotation between viewing angles
        rot = Gf.Rotation(Gf.Vec3d(*(t/norm(t))),
                          Gf.Vec3d(*[0, -1, 0]))

        # # Decompose rotation about given axes
        angles = np.array([*rot.Decompose(axes[0], axes[1], axes[2])])

        # Rotate the scene


Where an intrinsic rotation is an XYZ rotation and an extrinsic rotation is ZYX.