New Camera Tool: Point Camera [*new version 6 *]

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

New Camera Tool: Point Camera [*new version 6 *]

Postby Peteroid » Tue Sep 21, 2010 9:36 pm

*** UPDATE : There is now a version 6 with more functionality ***

Camera Tool: Point Camera

What it does: This tool allows the user to select a Layer and a Frame Range... when executed the camera will always look directly at the layer for the entirety of the frame range.


The way it works:

- Select a Layer (vector layers should work, others not sure - beta- )
- Select Point Camera in Tools
- Enter desired Frame Range in Toolbar area at top of screen
- Hit Execute


Things it DOES NOT CHANGE: camera position, layer position, camera zoom

Note the camera and layer may move around during this in any pattern!!!

WARNINGS: there are three cases that are prone to problems. When the layer and camera are at same point. In this case Point Camera does not add a keyframe, and leaves the frame alone. The other two cases occur when the layer is directly overhead or directly underneath the camera. This is dangerous, because panning just looks like rolling. It will still create a keyframe here though, and leave pan alone.

A PICTURE IS WORTH A THOUSAND WORDS (or in this case, two videos):

TUTORIAL 5.8.

BEFORE:

http://www.youtube.com/watch?v=qTI_gqJhDrk

AFTER: (pointing at Tree 7 for entire animaton).

http://www.youtube.com/watch?v=2YkazxgpsjQ


-------------------------------------------------------------------------
Installation files: http://www.peteroid.com/share/pao_point_camera.zip

unzip. Add pao_point_camera.lua and the two image files to the 'tool' folder under the AS folder.

There are now two versions included. 'pao_point_camera.lua' works for me in ASP7. 'pao_point_camera_AS5.lua' is an attempt to get it to work in AS5... I don't have AS5 so I can't test it. [UPDATE: tested and works]

If using the AS5 version, be sure to change the name of the file 'pao_point_camera_AS5.lau' to 'pao_point_camera.lua' before putting it in 'tool'.

Then you may update your '_tool_list' to be 'similar' to the EXAMPLE I've include. The one I included, if you just copy it and paste (the contents, it must still be named '_tool_list' in the 'tool' folder), it WILL work, but will remove the ability to use any other tools you might have custom installed in the past. Don't fool with this unless you really know what your doing.... (so how the hell did I manage...lol)...

You can skip the above '_tool_list' step, it just means the Tool will appear in the 'Other' Tool section and not in the Camera Tool section.
----------------------------------------------------------------------------------

I have not yet tested with anything but exactly one layer selected. I don't know what happens yet if the layer is not a vector layer.

So I still have to do error processing, if any.

Right now it will do this for frame 0 (is that ok?)

As a kind or added feature, if start > end then it just does the two end points (it will then tween between instead of being perfect). if start = end it just does that frame.

* * *

I have in mind MANY techniques that this can be used for. I'll post those in the future. but I want to test what I have first!

Let me know what you think! :)

-------------------------------------------------------------------------

UPDATE: [*new version 5*]

New version allows reversal of camera and to adjust the location the camera is focusing on by an (dx,dy,dz) delta vector.


UPDATE: [*new version 6*]

Added 'Use Parents'. When this is checked the position of the Layer takes into account any effects by the Parent[s]. Thus, it is the trues spacial location in the 3D world. Typically, this option will be set to true.

PS - I have also added this feature to my other camera tools, so get new versions (I tend to improve them on occasion without notice...hehe).
Last edited by Peteroid on Sat Oct 02, 2010 2:14 am, edited 18 times in total.
[==Peter==]
User avatar
Peteroid
 
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV

Postby funksmaname » Tue Sep 21, 2010 10:52 pm

yay! you finally got there...
I'll give it a test soon as I get some time!

congrats on your first script :)
User avatar
funksmaname
 
Posts: 3104
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Postby ulrik » Tue Sep 21, 2010 10:55 pm

Hi!

This looks very interesting, I looked at your videos and indeed I can see that this script could be useful!

Thnaks a lot for this! :D
ulrik
 
Posts: 1061
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden

Postby Peteroid » Wed Sep 22, 2010 3:59 am

funksmaname wrote:yay! you finally got there...
I'll give it a test soon as I get some time!

congrats on your first script :)


Thanks! :)
[==Peter==]
User avatar
Peteroid
 
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV

Postby patricia3d » Wed Sep 22, 2010 10:17 am

Thanks for your developments.
Will this work with 6.2?
User avatar
patricia3d
 
Posts: 725
Joined: Thu May 31, 2007 4:38 am
Location: India

Postby Genete » Wed Sep 22, 2010 11:45 am

Congratulations Peter!
-G
User avatar
Genete
 
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Postby Víctor Paredes » Wed Sep 22, 2010 4:07 pm

works great, Peteroid. Thank you very much. It's fantastic to have a new scripter on forum :D
Víctor Paredes - Former Moho 12 Product Manager
My Youtube Channel - My webinars
User avatar
Víctor Paredes
 
Posts: 4786
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland

Postby Peteroid » Wed Sep 22, 2010 4:41 pm

selgin wrote:works great, Peteroid. Thank you very much. It's fantastic to have a new scripter on forum :D


Thanks!

BTW... sorry to be so much of a pain in the ass when I was learning... now that I have my 'foot in the door' I should be more relaxed...

I get a bit TOO passionate about programming sometimes... hehe :)
[==Peter==]
User avatar
Peteroid
 
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV

Postby funksmaname » Wed Sep 22, 2010 9:58 pm

an idea:
Is there a way to keep the camera equidistant to the layer? at the moment having the camera pan around a layer that moved from left to right, and setting the layer to 'face camera' results in no rotation for the layer or position translation - which is cool, but it enlarges and shrinks presumably as the layer flies past the camera... is there a way to make the camera move back as the object approaches it and return once it passes so it 'looks' like there's no camera movement at all? (probably a checkbox rather than baked feature) :P
User avatar
funksmaname
 
Posts: 3104
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Postby Genete » Wed Sep 22, 2010 10:14 pm

funksmaname wrote:Hey there,
I'm a little confused... maybe i'm using it wrong?

I created a circle and had it move with layer translation from one side to the other... i then ran the script to point the camera, expecting the circle to effecively stay still but it sort of just turned slightly away from me in shame... sorry if i'm being a dumbass.


You have to move the camera and the script will fix the pan and tilt values to point always to the current selected layer. I don't know if it works for moving layers but it shouldn't be a problem.
-G
User avatar
Genete
 
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Postby funksmaname » Wed Sep 22, 2010 10:16 pm

Genete wrote:
funksmaname wrote:Hey there,
I'm a little confused... maybe i'm using it wrong?

I created a circle and had it move with layer translation from one side to the other... i then ran the script to point the camera, expecting the circle to effecively stay still but it sort of just turned slightly away from me in shame... sorry if i'm being a dumbass.


You have to move the camera and the script will fix the pan and tilt values to point always to the current selected layer. I don't know if it works for moving layers but it shouldn't be a problem.
-G


Thanks genete - but sorry, i deleted my previous post as i was using v1 of the script, v2 works more as expected :) (the problem had been i changed the layer origin) - you're too quick for your own good! ;)
User avatar
funksmaname
 
Posts: 3104
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Postby DK » Thu Sep 23, 2010 12:13 am

Confirmed latest version works in AS 5

Cheers
D.K
User avatar
DK
 
Posts: 2296
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Postby Peteroid » Thu Sep 23, 2010 2:04 am

funksmaname wrote:an idea:
Is there a way to keep the camera equidistant to the layer? at the moment having the camera pan around a layer that moved from left to right, and setting the layer to 'face camera' results in no rotation for the layer or position translation - which is cool, but it enlarges and shrinks presumably as the layer flies past the camera... is there a way to make the camera move back as the object approaches it and return once it passes so it 'looks' like there's no camera movement at all? (probably a checkbox rather than baked feature) :P


Indeed, I also think it would be cool for it to preserve visual distance.

This will take a bit if investigation, since I would need a PERFECT formula that converts zoom to 'effective distance', and this might not be possible since 'zoom' introduces visual distortion effects. Better to just move the camera itself to the desired visual distance!

And, here's the thing. This would no longer permit the camera to APPEAR to move on an 'arbitrary' path.

If the layer always looks like it is the same distance, then this is equivalent to restricting the camera to a circle of the desired visual distance. Thus, to accomplish, one need only put the camera a circular path and move it around (and apply Point Camera to force it keep looking at object).

I think most everyone, like me, is using Tutorial 5.8 as a means to test. This tutorial was not made with Point Camera in mind. To prevent this 'getting closer' and getting farther' look, just keep the camera the same distance from layer!

And THAT is a tool I might build. It would do this.... give it a frame range and a distance. When applied, the camera is moved to a position exactly equal to the distance supplied along the same line that connects the camera position and the layer (in this case, preserving tilt and pan).

Now, if you apply BOTH scripts you get the effect you asked for... but remember it will end up just moving the camera on a circular path around the layer. But this will be relative to the layers motion, so the camera will stay on a 'hoop' about the layer no matter where the layer goes!
[==Peter==]
User avatar
Peteroid
 
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV

Postby Peteroid » Thu Sep 23, 2010 2:13 am

Genete wrote:
funksmaname wrote:Hey there,
I'm a little confused... maybe i'm using it wrong?

I created a circle and had it move with layer translation from one side to the other... i then ran the script to point the camera, expecting the circle to effecively stay still but it sort of just turned slightly away from me in shame... sorry if i'm being a dumbass.


You have to move the camera and the script will fix the pan and tilt values to point always to the current selected layer. I don't know if it works for moving layers but it shouldn't be a problem.
-G


It keeps the origin of the layer in the center of the screen. But that doesn't mean the layer won't turn away from you.... it will!

Consider this. You stand in front of a friend and face directly at him. Now start to move in a circle around him while still facing his direction, and you will see him turn so his side is now in front of you! Continue and you see his back, then his other side, then his front again. So, from YOUR pov, he stay's in the center of your view and he turns away from you!

In other words, this does not move the camera, it points it at the layer, Thus, you can see it from any side.

It might be interesting for me to write a tool that keeps not only the origin in the center, but the layer at a perpendicular angle. But note this requires moving the cameras position, something PointCamera does not do (on purpose)...
[==Peter==]
User avatar
Peteroid
 
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV

Postby funksmaname » Thu Sep 23, 2010 3:30 am

well, there's 3 empty spaces next to your point camera tool that are waiting to be filled...

how about 'dolly on target' - we could have a non rendering camera target layer...

My main issue is i don't want things warping really - since this is 2D animation, i want all planes to be always perpandicular to the camera rather than skewed in 3D... :)

maybe if we had the same tool as you already have but have it do the move instead of tilt, and we could run both tools if we want both functions? then we could control zoom manually on top of those keys? *shrug* thinking on my feet here, i've not really used camera moves much until recently, and then for some reason the zoom/move weren't happening at the same time, so i was getting odd camera moves... possibly just me being rubbish :D
User avatar
funksmaname
 
Posts: 3104
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest