VSFX 705
Programming Concepts for Visual Effects

 

Linux Production Tools | Curve Generation using Particles in MEL | Animation & Modelling using MEL | Linux Batch Text Editor


(Latest updates are on top)

Curve Generation using Particles in MEL

Animated Growing Vines


Rendered images (Click for bigger images)
Playblast movie (Click to play)

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


 


The "Generate Curves"and Extrude Curves" are executed when the path of the particles are tweaked.
"Extrude Curves" will generate a 3D geometry from the curves and the nurbscircle.

 

 


Particles are added fields (gravity) and tweaked to simulate the movement of the vines. (collision is added to the inner and outer pillars and the base)
Few runs are done to make sure no particles escape the inner and outer hulls of the pillar .

 


A Hull object slightly bigger in size is used to contain the particles generated (using particle collision) when the path is generated.

 


A Windowed GUI is added to allow for keying values directly onto it. A query flag is used to pass user input onto the procedure:
`intField -query -value $fld_startframe`

 


To get the adjust vaules of Tip Width, Length and Radius Control, attributes were added to the nurbscircle used for the extrusion of curves:

addAttr -ln tipWidth -k true -min 0 -max 5 -dv .01 $mycircle[0];
addAttr -ln length -k true -min 0 -max 1 -dv 1 $mycircle[0];
addAttr -ln radiusControl -k true -min 0.0001 -max 25 -dv 1 $mycircle[0];
connectAttr ($mycircle[0] + ".radiusControl") ($mycircle[0] + ".scaleX");
connectAttr ($mycircle[0] + ".radiusControl") ($mycircle[0] + ".scaleY");
connectAttr ($mycircle[0] + ".radiusControl") ($mycircle[0] + ".scaleZ");

 

 

 

 

 

Animation & Modelling using MEL

Animated Spiral Molecules

 

 


Final textured and rendered animation from Maya (click to play)

 


Animated a camera move in Maya and rendered a sequence of .RLA files to extract the z-depth information to add depth of field.

 

 


The lofted Nurbscircle tube with the spheres populated and animated using the same expression. (GUI Slider controls will affect both the lofted tube and the spheres)

Other future consideration and updates would be to add sliders to specify the sphere numbers and size.

 

 

Nurbscircles are generated using the for loop and animated using the sin wave expression :

//populate with nurbscircle

for ($i=0; $i< $numSpheres; $i++){
string $mycircle[] = `circle`;
setAttr ($mycircle[0] + ".tz") ($i*3);

string $attr = $mycircle[0]+ ".ty";
string $exp = $attr + " = sin(time*Spiralmolecule_locator.Speed +("+$i+"*Spiralmolecule_locator.Frequency))*
Spiralmolecule_locator.Amplitude";
$myExpr = `expression -s $exp -o ($mycircle[0] + ".ty") -ae 1`;

 

An offset of -30 degrees is added to all the nurbs circle to ensure that they line up to the cross section of the lofted object before the loft command is executed :

// Position circles in spiral manner and loft
move ($i * $Circum) 0 ($i * $Circum);
rotate -pivot 0 0 0 -y ($zRotation * $i * $Gap);
rotate -r 0 -30 0 ;
}
select -all;
loft -sectionSpans 3;

 

To get the spheres to spiral, the use of the increment counter " i " is used in the move command to offset the objects by going through a loop :

move ($i * 0.6) ($i * 0.1) ($i * 0.5);
rotate -pivot 0 0 0 -y ($zRotation * $i * $Gap);

 

GUI Slider controls for attributes such as Amplitude, Frequency and Speed are also implemented :

// Create Locator
spaceLocator -name "Spiralmolecule_locator" -p 0 0 0;

// add Amplitude controller
addAttr -ln "Amplitude" -at double -min 0 -max 10 -dv 3 Spiralmolecule_locator;
setAttr -e-keyable true Spiralmolecule_locator.Amplitude;

 

 

The basis of the spiral molecule started with a simple wave of spheres which uses expressions to drive the animation :

Based on the number of spheres entered by the user, it will loop accordingly and generate the specified number of spheres:

for ($i=0; $i< $numSpheres; $i++){
string $mysphere[] = `sphere`;
setAttr ($mysphere[0] + ".tz") ($i*3);

The built in Sine function drives the spheres in a wave-like animation :

string $attr = $mysphere[0]+ ".ty";
string $exp = $attr + " = sin(time*Spiralmolecule_locator.Speed +("+$i+"*Spiralmolecule_locator.Frequency))*
Spiralmolecule_locator.Amplitude";
$myExpr = `expression -s $exp -o ($mysphere[0] + ".ty") -ae 1`;

 

 

 

 

 

 

 

 

 

MEL Modeling

11/10/2010

Using conditionals: if($x > 1 && $x < 4 || $y > 1 && $y < 4 || $z > 1 && $z < 4 ) , we're able to have an option to replace the spheres with cubes.

Also, the use of setAttr is used for translation and scale routines:
string $currentcube[] = `polyCube`;
setAttr ($currentcube [0] + ".translateX") (2 * $x);
setAttr ($currentcube [0] + ".translateY") (2 * $y);
setAttr ($currentcube [0] + ".translateZ") (2 * $z);
setAttr ($currentcube [0] + ".scaleX") 1;
setAttr ($currentcube [0] + ".scaleY") 1;
setAttr ($currentcube [0] + ".scaleZ") 1;

 

 

 

10/10/2010

Using 3 For Loops to create a 3 dimensional array of 6 spheres in the XYZ direction. The move values in the variables $X, $Y and $Z translates the spheres incrementally by the use of the for loop as well :

for($x = 0; $x < 6; $x++) {
for($y = 0; $y < 6; $y++) {
for ($z =0; $z <6; $z++) {

 

Linux Production Tools

Member and Password system

 

Setmember.sh is a script that checks for the existence of the member name and password in a file by using the grep and sed commands in Linux. It handles error by checking for the valid number of arguments, whether the membername or password already exists from a file.

createmember.sh is an additional script that facilitates user input of membername and password. Main features is that it checks for existence of membername or password in the file.

 

 

Linux Production Tools

Alias automation in a show production setting

 

This project uses BASH Scripting for allowing the user to quickly jump to their work directory with the use of an alias file .myaliases . Features of the setshot.sh script is that it allows user to enter 2 arguments to quickly go to the shot directory based on the user's current show directory.

It also handles error checking such as checking for valid directories, number of valid arguments and also whether setshow.sh has been run. (This is done by checking the $SHOW variable for existence)

 

 

 

Batch Text Editing


Batch Text Replacer

4/10/2010

This project uses BASH Scripting - BASH I've discovered stands for Bourne Again SHell. As I'm new to Linux commands, there is a whole lot of catching up for me to do, and I must say in a matter of a few weeks, creating a program from scratch is a bit daunting, but somewhat satisfying.

The purpose of the Batch File Replacer basically allows you to do replacment of any text string onto a batch or series of files. This could be useful for users wanting to change a version code on a series of Maya ASCII files, or certain paratmeters on Renderman RIB files. For this to run, kindly have all your files in the same directory as this program.

The will get the input from the user (wildcards such as *.txt, *.ma, document.* are acceptable) Also, it will check if uer has press returned on the keyboard, and it will quit the program using if [ ${#FILENAME} -eq 0 ];

Once the user enters the filename, the program will read the string to be repalced and the new string. It will first create a directory called BACKUP in the current working directory, and backs up the original file into it. If BACKUP folder exsists when you run the script again, it will not create a BACKUP folder, and will copy the original files into it.

The use of the Sed command sed -i "s#${STRING}#${NEWSTRING}#g" $FILENAME will substute STRING with NEWSTRING for FILENAMES specified by user.

Using the sed command within a For Loop allows the command to iterate for a batch files including filename with wildcards.

The new files will appear in the users current working directory , with the string replaced with the new string.

Future enhancements would be to add file checking capabilities using a for loop and the list command to check for the existence of files in the current work directory if the user keys in wildcards such as '*.txt' or 'document.*'

 

Not having a Linux machine, I've found a Bash Shell that runs on Windows and its called Cygwin, some advance commands however will error out and this has caused me some problems when I run it at SCAD which uses Red Hat Linux.

Nonetheless, it does provide me with a convenient and free way to practice basic Linux commands.

 

 

 

 

 

 

 

 

All Contents Copyright © 2001-2010, Kenny Ong,. All Rights Reserved.