Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2d pan/zoom, lock to object point, rotomation

Message 1 of 10
2450 Views, 9 Replies

2d pan/zoom, lock to object point, rotomation

So if this has been asked before then feel free to point me there

I’m doing some client object tracks and the client sent us some reference of how they are reviewing.
They are pan zooming the wire and transparent checker over the RGB plate

While this is available by default in most matchmove programs I can seem to find a way to do it in maya; where we often do most of our final tweaks, packaging and delivery

Trying to figure out how the maya 2d pan/zoom works under the hood so I can script something but I’m unclear

I was thinking maybe,
-find an object in camera space
-correlate that somehow with the pan/zoom feature

Once I can get that the pan/zoom is already renderable

Any insight or help would be great
Message 2 of 10
in reply to: adamghering

Hi @adamghering


I'm having a little trouble understanding your issue.


Are you looking for a camera to simply track an object or have it automatically follow different objects via pan/zoom?


If you're looking to lock to a point with the camera, you could use Camera aim under Create->Camera Aim which will give a camera an object to track which you could then parent to another object in the scene.


Please let me know if this helps or if I'm misunderstanding your question!



Message 3 of 10
in reply to: sean.heasley

I’m looking to follow the object with the pan/zoom that way it keeps the object centered and synced with the image plane that you have tracked to.
For when you have an animated camera and tracked object but want to center on one object for review

Reviewing this way is great to spot errors

You can do this when you render out of 3dequalizer by checking the ‘center on selected points’ when you render

Looking to emulate in maya
Seems easy enough if I can figure out what to plug into the pan/zoom then I can turn into a button rollout where you select your object and animated camera, executing would turn on pan/zoom and then feed the proper numbers to the pan/zoom to keep it in the viewport

Message 4 of 10
in reply to: adamghering

Hi @adamghering


Ok I know what you're going for and it does sound like it should be achievable in Maya.


I haven't done much work with tracking and Maya but I have a few ideas that may work for this.


To start, I took a basic cube and parented a camera to it so the camera keeps the object centered no matter how it pans.


On top of this you can constrain the Aim of the camera.

(1) Select the object.
(2) Shift-Select the camera
(3) Hotbox: Constrain -> Aim


After you tweak the numbers you can get the camera to follow the object for zooming in/out etc.


Please let me know if this helps at all or if you need any more assistance!



If one or more of these posts helped answer your question, please click Accept as Solution on the posts that helped you so others in the community can find them easily.




Kudos are greatly appreciated. Everyone likes a thumbs up!



Message 5 of 10
in reply to: sean.heasley

If I constrain aim the camera then aren’t I altering the tracked camera and the objects relationship to the image plane?

Or am I over complicating this
I feel like using constraints will break the baked camera animation and the locked In Relationship/perspective to the object in the scene

Message 6 of 10
in reply to: adamghering

Hi @adamghering


Ah right, it's possible it would break the baked animation.


When you get a chance, can you please zip and attach the scene file here or via dropbox/google drive or another file sharing program so I can take a look at it?


If the file is confidential or under NDA please send it to me in a private message!



Message 7 of 10
in reply to: sean.heasley

Hi @adamghering


Just wanted to check in to see how things were going. Are you still having this issue?


If your issue is resolved, please click Accept as Solution on the posts that helped you so others in the community can find them easily.



Message 8 of 10
in reply to: sean.heasley

I actually found my own resolution
I’ll repost here once the script is done but it goes something like this

- get object in cameraSpace (currently doing this with a locator parented to the camera and then point snapped to the object)

-divide x,y of locator by the z to get

-then get the vector through the object on the image plane (doing this with a bit of math division by using the locator vector and factoring the ratio based on the imagPlane depth

-divide x,y vector by imagePlane.boundingBoxMaxX( and Y)
- get the aspect ratio of the image and divide the Y value
- all of this gives an exact horizontal and vertical to connectAttr to the 2d pan/zoom x,y pan attributes
- also use the bounding box of the object abs max-min in Y as well as compare that against the object and imagePlane depths to get the zoom right

While this is live it centers the original object dead center and zooms in approprately keeping it centered on every frame

I will take it a step further and create a pop up to select objects and camera as well as a button to clear and reset it all so you can select a different object
Message 9 of 10
in reply to: adamghering

Hi @adamghering


Glad you solved it!


Thanks as well for coming back to this post and explaining what you did!



Message 10 of 10

Hey @adamghering ,
Is there any chance that you have completed your script? And do you mind sharing it? I'm very interested in your idea. I am a beginner in Python and also a junior matchmover. I think it will surely help a lot for me and other artists to find a way to QC (Quality Control) our point clouds in Maya. I would love to hear about it, and I might throw some ideas into the script.



Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators

Autodesk Design & Make Report