MCG Drop the Population

The Populate feature in 3dsmax is one of the most frustrating for me… the technology behind it is pretty damn awesome but the implementation is immensely frustrating, it’s awful for scripts/tool developers as there’s very little to access.  The quality of the models hasn’t been improved and the UI for making people look how you want them is very tricky to use.  When you know how you can actually make people look like business people.

popul

One of the most common frustrations is that the people can only walk on flat surfaces, putting ramps in is complicated and this doesn’t allow you to put things like kerbs in for people to walk off or have slightly undulating surfaces.  Someone asked if it was possible for Autodesk to add support for uneven surfaces and that gave me an idea.  Can we use MCG to move the meshes down to the surface? MCG is pretty good for doing ray-testing and manipulating meshes, so I gave it a go.  Here’s a Dave-friendly way of trying to explain how it works. It’s a fairly simple graph so I recommend opening it up and having a look!  It can probably be used for other things too so have a play and let me know!

populategraph

The challenge was to work out how to do a hit-test from the point of the character down to an object below. We start by using the Modifier (Matrix) which if we get the row4 element gets us the position of our node in world space. But how do we do a hit test I wondered….. which wasn’t too complicated to do once I discovered the Ray node which wants a position and a vector (direction made from ‘Z axis’ and turned downwards using the ‘Negate’node), this fires a ray off and you pass that to ‘NodeIntersects’ node which is which object in the scene you want to see if the ray intersects with, pass these two together and you’ll get a Tuple Value which consists of a ray and a boolean value, so with this we can find out where our intersection is and if it actually intersected as well. A Tuple value is two values together and to get just one out we use a PairItem1 node which gives us the first value, which in this case is the intersection Ray, so we use the node RayPosition to get the position of the ray and then we extract the Z point of this vector 3 to be able to put this into a new vector 3 value, which is an XYZ value, we want to offset the vertices in our mesh only in X (because Populate is weird) so we set Y and Z to a constant single (float) of 0.0 and then pass our new Z value to it and then pass this new vector to the OffsetMesh node.   I added a little extra Z Offset value to make sure that we could adjust the alignment if it wasn’t quite right (normally isn’t it turns out).

Version 1.1

If the Populate flow was created not at 0 in Z Axis you had to do a fairly hefty manual offset, now you just need to select your Populate Flow node as well and it doesn’t matter how high your Flow is, it’ll still conform down. Note, moving your flow node up and down after creating people won’t be interactive with this tool.

You can get it here on ScriptSpot.

http://www.scriptspot.com/3ds-max/mcg/populate-drop-to-surface

I have real hopes for what MCG will bring to 3dsmax, little things like this are easy to set up and extremely powerful!   I wonder if I can make a Populate person walk along a custom spline… hmmmm

Advertisements

About davewortley

Somewhere between an artist and a programmer, I like technical things, but being creative. I love problem solving and coming up with elaborate solutions. This blog is where I shall share ideas, tips, tutorials and anything that amuses me.
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to MCG Drop the Population

  1. Scott Dombrowski says:

    Hey Dave, I didn’t get a chance to thank you on the other forum before it closed, but I wanted to let you know that this works great! Thanks again for your efforts!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s