Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 15-01-2003 , 10:03 PM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172

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.

# 2 15-01-2003 , 10:41 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
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!
# 3 15-01-2003 , 10:48 PM
dannyngan's Avatar
Registered User
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
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... user added image


Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
# 4 15-01-2003 , 10:50 PM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
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.

# 5 15-01-2003 , 11:36 PM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
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?

# 6 15-01-2003 , 11:44 PM
dannyngan's Avatar
Registered User
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
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
# 7 15-01-2003 , 11:48 PM
mark_wilkins's Avatar
Registered User
Join Date: Jan 2003
Posts: 161
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:

// user added image
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
# 8 16-01-2003 , 12:02 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
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!

# 9 16-01-2003 , 12:05 AM
mark_wilkins's Avatar
Registered User
Join Date: Jan 2003
Posts: 161
Well, I've got a book to sell you... :yipee:

-- Mark


Mark R. Wilkins
author of MEL Scripting for Maya Animators
www.melscripting.com
# 10 16-01-2003 , 12:11 AM
dannyngan's Avatar
Registered User
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154

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. user added image


Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
# 11 16-01-2003 , 12:24 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
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.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads