Friday, February 12, 2010

Modeling bumpy polygon plane

This simply Python script creates bumpy surface on a polygon plane by altering the Y position of each vertex points in a random manner. The User Presets area can be edited according to your needs.

import maya.cmds as cmds
import random

#User Presets Below This Line-----------------
numberOfVertex = 10200 # Number of vertexes
pName = 'pPlane1' # Name of polygon plane
loR = -5 # Lowest point of bumping
hiR = 5 # Highest point of bumping
mult = 0.1 # Magnitude of randomness
#User Presets Above This Line-----------------

for i in range(1,numberOfVertex):
    vtx = ('%s.vtx[%s]'%(pName,i))

Note that if your polygon plane is very high in resolution, it might take longer to complete depending on the processing power of your machine. I tried 10000+ vertexes and it took my computer's Maya about 30 seconds to complete.

Don't panic if Maya froze during the process!

No comments:

Post a Comment