SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Help with expressions for polyplanes
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 15-01-2003, 09:03 PM   #1
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default Help with expressions for polyplanes

Due to the fact that Windows Movie Maker cannot play 15 individual images from my HD per second (trying to do a real cartoon), I have turned to Maya. Basically, I have an unholy number of images that need to be played to create a cartoon animation. I have a total of 500 images my friend drew on my HD. I am wanting to stick each image on a plane and move it to create the illusion of animation.

Here's how it will hopefully work - There are 500 Pplanes in a row (on the X-axis) spaced .05 units away from each other. I have a camera in front of the first Pplane. On frame 1, all 500 Pplanes need to move forward (positively on the X-axis) .05 units. This needs to happen every frame. I could do this easily by grouping all 500 together and use the following expression -

group1.translateX = time + .05;

however, (here's the tricky part) the frontmost Pplane needs to be moved out of the way at the same time. I had planned to simply move it over 2 units on the Z-axis, but I don't know enough about expressions to do it. I thought I could use this expression for each Pplane...

(this exp. for Pplane1) ----- if (translateX >= 0) Pplane1.translateZ = 2
(this exp. for Pplane2) ----- if (translateX >= 0) Pplane2.translateZ = 2

...but unfortunately, the translateX NEVER CHANGES!!! This is because all 500 Pplanes are in a group and it is the group's translateX that is moving. Needless to say, I am stumped. I don't know what to do. I know exactly how to animate each one with keys properly, but I figure it would be faster to use expressions - even if I have to write one for each Pplane.
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 15-01-2003, 09:41 PM   #2
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Are you doing this just for MEL practise? Because you could just rename the images so that their file extensions are numbers corresponding the frame number. Like image.0000 image.0001 and so on. Then you could load the first image in to an image plane and animate the whole thing using the frame extension option in the file texture node...

Or is this some other kind of animation where you actually move those images instead of flipping them in front of the camera?
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 15-01-2003, 09:48 PM   #3
dannyngan
Registered User
 
dannyngan's Avatar
 
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
Thanks: 0
Thanked 1 Time in 1 Post
Default

If you're just looking for a way to make a movie of the frames, why not just load the image sequence into Fcheck and export a movie from there? It'll save you a lot of hassle...
__________________
Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
dannyngan is offline   Reply With Quote
Old 15-01-2003, 09:50 PM   #4
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Wow. I guess I could do that. I wish I had thought of that before I wrote all of the above and spent about 45 minutes trying to think up an expression. On the other hand, I guess I would like to know how it would be done in MEL. I need practice anyway.
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 15-01-2003, 10:36 PM   #5
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Ok. I renamed the files. Talk about a long, boring job. Anyway, the 500 images are just backgrounds. We had decided from the beginning to create this anime movie by drawing layers just like real animators. Right now, he and some of his buddies are working on the actual characters. I figure I can overlap the character animation with the background animation by making the alpha channel transparent. Only thing my friend has to watch out for is colouring anything white. If he does, I guess I won't be able to make he alpha channel transparent in those particular shots unless there is a way to control what colour the alpha channel is besides black or white. Is there?
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 15-01-2003, 10:44 PM   #6
dannyngan
Registered User
 
dannyngan's Avatar
 
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
Thanks: 0
Thanked 1 Time in 1 Post
Default

Technically, the alpha channel is independent of the color channels. It doesn't matter what's in the image -- the alpha channel will either reveal or show parts of it. You could also take the chromakeying route -- pick a color that isn't in the animation and use that as the masking area. Not nearly as clean as an alpha channel, but it'll work.
__________________
Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
dannyngan is offline   Reply With Quote
Old 15-01-2003, 10:48 PM   #7
mark_wilkins
Registered User
 
mark_wilkins's Avatar
 
Join Date: Jan 2003
Posts: 161
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, I don't recommend doing what you're doing with a bunch of planes, obviously, but you can always do something like this:

// pplane1 expression
if (group1.translateX > 0.05) Pplane1.translateZ = 2;


// pplane2 expression
if (group1.translateX > 0.1) Pplane2.translateZ = 2;

or you could always use the xform command to get the world-space position of your plane:

//
float $myPosition[] = `xform -query -worldSpace -translation Pplane1`;
if ($myPosition[0] >= 0) Pplane1.translateZ = 0;

This isn't as nice because using the xform command might cause the entire Dependency Graph to be reevaluated for each frame, which can make certain scenes evaluate rather slowly. However, it does work.

-- Mark
__________________
Mark R. Wilkins
author of MEL Scripting for Maya Animators
www.melscripting.com
mark_wilkins is offline   Reply With Quote
Old 15-01-2003, 11:02 PM   #8
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Wow. See, I don't know what anything says in that last expression. I have got to get a book on this stuff and learn. I feel left out!

Dannyngan - how do you go about masking? I searched a little and read something about using stencils, but I can't get it to work. I probably won't use it, but if I do, I'll need to know how to do it.

Thanks for all your helps guys!
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 15-01-2003, 11:05 PM   #9
mark_wilkins
Registered User
 
mark_wilkins's Avatar
 
Join Date: Jan 2003
Posts: 161
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, I've got a book to sell you... :yipee:

-- Mark
__________________
Mark R. Wilkins
author of MEL Scripting for Maya Animators
www.melscripting.com
mark_wilkins is offline   Reply With Quote
Old 15-01-2003, 11:11 PM   #10
dannyngan
Registered User
 
dannyngan's Avatar
 
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally posted by Darkware
Dannyngan - how do you go about masking? I searched a little and read something about using stencils, but I can't get it to work. I probably won't use it, but if I do, I'll need to know how to do it.
The simple answer: In your video editing program of choice, put the character layer on top of the background layer. Tell the character layer to either use the alpha channel for transparency or use a filter/effect/operator (whatever the software calls it) to knock out the keying color. The last one is typically called a chroma key.

The long answer: Depends on which software you're using.
__________________
Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
dannyngan is offline   Reply With Quote
Old 15-01-2003, 11:24 PM   #11
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Ok. In the attributes window of my file1 texture, there is an effects section. In there is a filter value and a checkered box to the right of it. I clicked the box and chose the check texture. I turned both color 1 and 2 to green to try to take out the grass in a background scene. The filter worked, only it took out everything but the grass. I need to reverse this effect somehow, but can't figure out how. And by the way, all I have is Maya. No other video editing software.
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.