Journal Entry for 2/8/08

By lanceromance

Today we discussed how to randomize the attribute variables of particles using MEL (Maya Embedded Language) scripting. We accomplished this by creating “expressions“. We learned about 2 types of expressions today. The first type, the creation expression, calculate the expression (something such as a random radius, or color, etc.) only when the particle is created. The second type, the runtime expression, re-calculates the expression every frame. We also went over the different types of variables which are float variables (a single number) and vector variables (a set of 3 variables separated by commas – to describe such aspects as X,Y,Z positions, or rgb color values).

An example of an expression using a float variable would be: particleShape1.radiusPP=rand(.001,1);

*the above script would be used to randomize the radius of particleShape1(.001,1);

An example of an expression using vector variables would be: particleShape1.rgbPP=<<rand(1),2,3>>;

*the above script would be used to randomize the colors of particleShape1(.001,1);

In addition to learning the above, we also covered particle instancing which allows you to create your own geometry and use that shape as a particle type.

One Response to “Journal Entry for 2/8/08”

  1. otto Says:

    nice detailed post, lance. also remember that ‘rand(1)’ is the same as ‘rand(0,1)’

    have a good weekend and buy an alarm clock

Leave a Reply