Maya 3D Tutorial – Shuffling MASH Points with the Python node

What’s New this week with Maya 3D?

@AdskMaya, Autodesk Maya’s twitter account shared an article by Ian Waters (http://ianwaters.co.uk/); Whys and hows of shuffling your MASH points in Maya. The article is a short tutorial to create random spokes animation as shown below.

shufflePoints

Here’s the Shuffling MASH Points with the Python node tutorial (Originally posted here–> http://ianwaters.co.uk/wp/mash/shuffling-mash-points-with-the-python-node/

Start with a grid distribution as shown below:
Grid

When MASH creates a grid distribution, all the points are in an order (0, 1, 2, 3, 4 across the top here). I’ve used the Points node to visualise the numbers here.

PointIds

If we add a Trails node to create some lines between a single point and say, 30 MASH points, it will connect to the first 30 points. See below.

maya-random-spokes-animation

This is obviously not what we’re after so we need to add a Python node to shuffle our MASH points and put them into a random order. This means that even though the first 30 points are connected, they’re all in a random order.
You can copy and paste the below into a Python node. It will shuffle all the points in any MASH network.

python-node

maya-random-spokes-animation-shuffled

As you can see, our ids are now shuffled. You can animate this by ’rounding’ the seed. In this example, every 10 frames we change the seed (it’s rounded up in 10s). I’ve commented out a version that will change the seed every 20 frames so you can see how it works.

python-node2

So there are actually 2 MASH networks here. The first one just has a grid of little dots. The second one is more interesting; the Instancer is empty, but it has the same grid in the Distribute node as the first network. The second network is the one with the Python and Trails nodes.

The reason there are two different networks is because in the animation the Trails wander about but the grid stays still. So, on the network with the Trails on it, as you’ve probably guessed, I added a Signal node to make the trails animate about.

The finishing touch was adding an Offset node and using the Low Clamp and High Clamp settings to clip the point positions and keep them inside the grid. Before and after below:

clamp-settings

On the left are the clamp settings. On the right is how the MASH Editor looks when we’re finished (ignore the Id node!).

mash-editor

garagefarmvhic

GarageFarmVhic is a freelance blogger who specializes in creating content for render farm, 3d modeling and 3d software among other topics.

Leave a Reply

Your email address will not be published. Required fields are marked *