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

User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Thu Sep 23, 2010 4:10 am

funksmaname wrote: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
AHA! I know a tool I should build then... and it won't be too hard.

The problem with PointCamera is it IS a 3D tool. That means if it is looking at a layer (well, it's origin) and the layer moves in the Y direction, you get non-zero tilt.

Zero tilt only occurs if the camera and the origin of the layer are at the same Y height.

SOOOOO...

My next tool will be the following (and this one I bet I'll have done before the end of the weekend):

FloatCamera

What it will do
: Using the selected Layer, for the given range of Frames adjust the height of the camera to be the exact same height as the Layer.

This will only effect camera position, and only it's Y-coord.

Now, assuming you are working with a 2D paradigm (i.e., 2D characters in front of a 2D background that are on different 'plane's, not different distances), COMBINE FloatCamera and then PointCamera (and the order is important, these are not communative operations) and you get the effect you want, the layer is always dead center and no-tilt. This is becuase it will first raise the camera to match the height of the layer. Thus, when PointCamera is now applied, since the difference in the y-coord is always 0, there is NEVER ANY TILT!

But there is still going to be SOME distortion. It IMPOSSIBLE to make a visually non-centered rectangle look like a perfect rectangle! That's becuase as soon as you get off-center one side of the layer is closer than the other, so it will appear longer (parallax effect).

Basically, like it or not, Anime Studio is a 2D program that can only work when embedded in a 3D space. Putiing this simply, the camera can't be in the same plane as all the layers, or there would be nothing visible. So, the camera HAS to move away from the plane, and that can only be done in 3D space. And, the farther back you move, the more parallax there is. But, more importantly, if you can see it, there is ALWAYS a parallax effect.

BTW, the real world works the same way... even more so since we have two eyes looking from two different locations...

But at small distances this is not noticable. But I say this because rectangles will almost never be PEREFECT rectangles, but close enough for government work.

So I'll do FloatCamera this weekend... :)
[==Peter==]
User avatar
funksmaname
Posts: 3113
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Post by funksmaname » Thu Sep 23, 2010 4:40 am

you could manually set every layer to 'face camera' - maybe that's another tool - to tick on/off face camera on multiple layers :P
User avatar
DK
Posts: 2496
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK » Thu Sep 23, 2010 4:47 am

It would be ultra handy to have multiple 'Point Targets" for set frame ranges, for instance, you could have a conversation between several characters and instead of manually targeting the camera for each set of dialogue you could program the camera to switch between the multiple targets. I imagine it should'nt be too hard to create that featutre as it's not too far away from what the script is already doing.

Cheers
D.K
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Thu Sep 23, 2010 5:15 am

Well... it turns out writing one's second script doesn't take as long as the first.... (hehe... this one only took me an hour, but it was an easy modification from PointCamera):

This is only the ASP7 version (AS5 tomorrow)... but...

Float Camera Tool : http://www.peteroid.com/share/pao_float_camera.zip


NOTE: if you use this with Tutorial 5.8, be aware the Origin of each Tree has been set to its base, hence FloatCamera will be totally level with the ground, and so the ground visibly will just be a line on the screen!

---

In the next few days I will also add a 'use origin' check box for PointCamera. If off, it will act as if Orgiin = (0,0). If on, it will factor in Origin. In Tutorial 5.8, turning this OFF will never tilt the camera (due to the fact the Trees are actually at camera height (just not the Tree's origin).

That may be confusing. A Layer has a location defined by where you FIRST draw it. It also has an Origin based on this point offset by the Origin value. So a Layer actually has TWO spots on it that can be considered its 'location', but they are the same if one never moves the Origin when defining the Layer. Its the Origin one the PointCamera typically uses, and it is the Origin the AS system uses as THE location for the layer when moving it...
It would be ultra handy to have multiple 'Point Targets" for set frame ranges, for instance, you could have a conversation between several characters and instead of manually targeting the camera for each set of dialogue you could program the camera to switch between the multiple targets. I imagine it shouldn't be too hard to create that feature as it's not too far away from what the script is already doing.
What would you suggest I use to indicate when to do the switching between characters?

It is possible that most methods that allow you to 'tell' the script which character to face is not going to be too much easier than just 'select character 1, select first frame range, execute, select character 2, select frame range, execute, etc.

But I'm definitely open to suggestions!
[==Peter==]
User avatar
funksmaname
Posts: 3113
Joined: Tue May 29, 2007 11:31 am
Location: Nelson, New Zealand

Post by funksmaname » Thu Sep 23, 2010 5:19 am

sweet - will download the latest script... you did it so quick you didn't have time to make an icon! :P

I dont think the switching needs to be automated... if you could just select a layer and tell it to be the target, then move on and select another layer to be the target, that would result in what DKs suggesting right?

I dont think we should try getting too ahead of ourselves with complete automation, otherwise it's all pointless :P

--

just downloaded - i guess i spoke too soon re: icon! i think you've found your calling! :)

--

sorry dude, i'm still a little confused as to what it does... it seems to create camera tracking keys, as well as a pan/tilt key at either end of the range... but it seems to be those that are actually doing anything - if you delete them the camera is still...?
Last edited by funksmaname on Thu Sep 23, 2010 5:27 am, edited 1 time in total.
User avatar
DK
Posts: 2496
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK » Thu Sep 23, 2010 5:22 am

Oh....I see you CAN do multiple layers now! Just by selecting a new layer and frame range. My bad :)

Cheers
D.K
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Thu Sep 23, 2010 5:25 am

funksmaname wrote:sweet - will download the latest script... you did it so quick you didn't have time to make an icon! :P

I dont think the switching needs to be automated... if you could just select a layer and tell it to be the target, then move on and select another layer to be the target, that would result in what DKs suggesting right?

I dont think we should try getting too ahead of ourselves with complete automation, otherwise it's all pointless :P

--

just downloaded - i guess i spoke too soon re: icon! i think you've found your calling! :)
No, actually, it has the included icons (pao_float_camera' and 'pao_float_camera_large') ... drawing the icon took 45 minutes of the hour... LOL

You still need to change '_tool_list' in 'folder 'tools' to put the tool in the Camera area though...
[==Peter==]
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Thu Sep 23, 2010 1:52 pm

The download of 'Float Camera' now contains an AS5 version (untested)...

http://www.peteroid.com/share/pao_float_camera.zip
[==Peter==]
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Point Camera - Version 3 - 'Use Origin' checkbox

Post by Peteroid » Thu Sep 23, 2010 2:44 pm

There is now a version 3 (both AS7 and AS5, AS5 untested by me).

This new one has a 'Use Origin' checkbox. If checked the camera will point at the Origin of the Layer. If unchecked, it will point at the Layer as if Origin = (0,0).

Roughly speaking, when you first create a Layer, it has a 'default' Origin. This is the center of the screen when you draw/create the Layer in frame 0 (without the effects of Offset Bone). When you change the Origin, you are setting an offset from this 'default' Origin, which is then used as the 'effective' Origin. It is the 'effective' Origin AS uses as the overall position of the Layer.

Therefore, unchecked uses the 'default' Origin of the Layer, and checked uses the 'effective' Origin of the Layer.

LINK: http://www.peteroid.com/share/pao_point_camera.zip

To see its effect, test on Tutorial 5.8. if unchecked the camera and trees have the same 'default' origin, so it never tilts.When checked, as the camera approaches the target tree, it will tilt to point to the 'effective' origin, which is at the base of the tree. It is a subtle effect, and is really only visibly noticeable when the camera gets close to the tree.
[==Peter==]
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Thu Sep 23, 2010 3:09 pm

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
OK.... next... your turn... :)

I will now create a Tool called 'Kite Camera'. This will have as parameters a Distance Range and a Frame Range. 'Kite Camera' will preserve the bearing between the Camera and the Layer, but will cause it to animate in such a way that at the beginning of the frame range it will be at the beginning of the distance range, and at the end of the frame range it will be at the end of the distance range (tweening).

Thus, if it is desired to have the camera always be at a fixed distance, just set the beginning and end of the distance range to be equal.

FYI... why I call this 'Kite Camera'.... the effect will be as if the Layer/Character the Camera is associated with via this tool will follow the Layer/Character as if on a tethered kite string, and the ability to increase or decrease distance over time is effectively like letting the kite string out or pulling it back in... :)
[==Peter==]
Vagabond
Posts: 106
Joined: Wed Aug 19, 2009 11:44 pm
Location: Connecticut
Contact:

Post by Vagabond » Thu Sep 23, 2010 4:57 pm

reading posts with bated breath... what's next? Are these the camera tools I've been looking for? My chase scenes are going to be AWESOME!!

Peter, I have a theory that a script can be written to create stereoscopic 3D rendering. Instead of using red and blue for 3D, two images that are about 45degrees off from center are shown at the same time. Can these two camera views be scripted from the main camera view? If possible, your script could usher in a new era of home cartoonery! Or the rendering times will freeze everyone's computer.
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Sat Sep 25, 2010 4:57 pm

Here's a fun thing I did quickly just using the Point Camera tool.

I took Tutorial 5.8 and stripped out all the animation. Then I raised the camera to Y=3.5. I started the camera at Z=+10 for frame 1 and tween to Z=-10 at frame 192. Finally, I have it Point Camera at Tree 2 for frames 1 to 192.

The effect is a similar to someone in a plane flying by and looking at the tree on the ground...

YouTube Video: http://www.youtube.com/watch?v=_k7l7uFK_mk
[==Peter==]
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Sat Sep 25, 2010 7:59 pm

*** I found a bug that happens rarely.... ***

The download now contains a new version with the correction...


This is the same link as the OP, just here for convenience:

Installation: http://www.peteroid.com/share/pao_point_camera.zip
[==Peter==]
User avatar
Peteroid
Posts: 162
Joined: Thu Aug 12, 2010 3:57 am
Location: las vegas, NV
Contact:

Post by Peteroid » Sat Oct 02, 2010 2:41 am

version 6.... some added important features, such as 'use origin' and 'use parents'. The new versions can be downloaded at its same download location. More info added to OP.

I have added these features to all the camera tools, also available for download at their same download locations.

ALL CAMERA TOOLS Package at:

http://www.peteroid.com/share/pao_camera_tools.zip
[==Peter==]
User avatar
chucky
Posts: 3937
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land
Contact:

Post by chucky » Mon Nov 01, 2010 4:20 pm

Peteroid WOW you GENIUS, thank you sooo much the has really helped a lot.

I have no idea why all these innovations are left up to forum members though, but I am indebted to all the script gurus here.

Hey I had an immediate thought after applying this to an object that I pan with and stop as it passes.
You know the typical "car/plane /person passes" shot?

Aaanyway, the script works perfectly during for the middle section, then as I release the camera to let the object pass and exit frame, that old rotate to face camera conundrum occurs and the objects start to distort.
So I am wondering if it is possible to write the exact same script but to apply to layers.
That way I could execute the layer version to the exiting layer and it will continue to look 'nice'
This has only been and issue recently as I think something has changed in the native camera settings, you could probably enlighten me on that point.

Thanks again for the great scripts Peteroid.
Sequential offender.
my latest animations
Post Reply