« another colony distributions test
» Happy birthday Ollie


ICE crowd flow

02.05.09 | 3 Comments

An old test for crowd flow over a mesh using some of Craig Reynold’s classic boid flocking methods.

This test involves moving particles in space, using noise and proximity to neighbours as simulation forces.

During each step, force vectors are resolved by adding up a final force vector and projecting back onto a surface using the Get Closest Location node.

Here is a vimeo of the surface flow in action

This shows particles flowing over the mesh roughly avoiding each other. The colour is driven by the number of the particles’ neighbours (like a simple density function).

Here I have a 4D curl noise driving the overall swirl and a polar rotation driving the particles around the sphere. There is a weight map on the mesh which reverses the polar rotation around the equator.

Finally, a repulsion force is calculated. This force is taken from Reynold’s boid model.

The Get Closest Location node is possibly the most powerful node in the ICE node list.

When I was writing python code in XSI to generate my first few sphere packing point distributions (before XSI v7), I used an SDK primitive called point locators (.. which thankfully having nothing to do with Maya’s version of nulls). Point locators provide a parameterised way of defining a location on a mesh.

The point location on a mesh is defined by a triangle ID1, and barycentric coordinates within that triangle. This provides a way to locate a unique position on a polygon mesh.

The XSI SDK provides methods for converting a worldspace vector into a mesh’s point locator, as well as converting a mesh’s point locator back into a worldspace vector.

Extra bonus DELUXE points are scored by point locators for their ability to evaluate any cluster property on the mesh, at the position of the point locator. This means you can sample an interpolated weight map, colour-at-vertices map, texture map, or even an map of envelope weights at any point on the surface.

The output of the Get Closest Location ICE node is a point locator.

This means I can sample a weightmap to influence closest-point-on-surface particle forces. The control this offers is very direct. It is so easy to just paint a map on a surface to influence particle simulations.

  1. triangle ID: This is actually a bit flawed because usually the point will be sampled from a deforming mesh. Meshes to be rendered as subdivision-surfaces are mostly made from four-sided polygons whose triangulation can switch between opposite vertices frame-to-frame depending on the tesselation scheme. Re-referencing a point locator after a deformation of the mesh can lead to the triangle ID pointing to a slightly different triangle. I think i remember a whiff of a solution on the xsi mailing list .. []
Tags: , , , ,


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

« another colony distributions test
» Happy birthday Ollie