Python: Maya Particles


main index



Introduction

This challenge will enable you to explore several basic concepts of python programming:
- use of lists
- use of loops
- use of mathematical expressions
- use of tests
- writing of files

The challenge will introduce you to a technique by which Maya nParticles can be procedurally created so that they form geometric shapes.


Maya Particles

To successfully complete this challenge you will write two python scripts. The first script will contain at least 5 procedures. Each procedure will produce a list of "xyz" values that will control the positions of the nParticles so that they form a specific shape. For example, the following python script implements a procedure called cubic().

#------------------------- gen_points.py --------------------    
import random
import math
  
def cubic(num_points, side):
    data = []
    count = 0
    half_side = side/2
    while count < num_points:
        x = random.uniform(-half_side, half_side)
        y = random.uniform(-half_side, half_side)
        z = random.uniform(-half_side, half_side)
        data.append( (x,y,z) )
        count += 1    
    return data
#------------------------------------------------------------ 

You are expected to implement the following procedures,

    spherical(num_points, radius)
    cylindrical(num_points, radius, height)
    box(num_points, width, length, height)
    cone(num_points, radius, height)


The second python script will use functions defined in the first script. For example, the next code snippet implements a procedure called cubicCloud().

#-------------------- maya_particles.py -----------------------
import maya.cmds as cmds
import gen_points
  
def cubicCloud(num_particles, side):
    # Use the gen_points module to create a list of points
    data = gen_points.cubic(num_particles, side)
    
    # Use Maya's python command to add the cubic particle
    # cloud to the viewport. Capture and return the name of 
    # the particle system. 
    return cmds.nParticle(p=data)[0]
#------------------------------------------------------------    

You are expected to implement and add following procedures to the maya_particles script,

    sphericalCloud(num_points, radius)
    cylindricalCloud(num_points, radius, height)
    boxCloud(num_points, width, length, height)
    conicalCloud(num_points, radius, height)



What is Expected?

The technical breakdown on your web page should show the following.
1     at least one rendered image of each of the Maya nParticle shapes,
2     at least one animation of each of the Maya nParticle shapes,
3     a technical breakdown that explains how the images were created.



Grading

The following categories will be used for grading your work.


Criteria

Below Average

Average

Above Average

  Demonstrates creativity

 

 

 

  Technical breakdown

 

 

 

  Research/investigation

 

 

 

  Self evaluation