Form and Space

creating CG 3D since 2001

  • Connect @
  • Linked in
  • Vimeo
  • Twitter
Infinite Stairwell

Iterated Space Transformation

Matthew | November 8, 2011

3 Comments

One of my classroom assignments is to model a spiraling staircase, or iterated transform of objects. I find this assignment to be very exciting, as it introduces my students to modeling with multi-dimensional arrays. Then my one of my students, Casey, found a reference on Google images that I hadn’t seen before. A sculpture by Peter Coffin at the Saatchi Gallery.

Untitled (Spiral Staircase)
2007
Aluminum and steel
670.6 x 670.6 x 213.4 cm
Peter Coffin

Now, this is interesting, and it peaked my curiosity to try and recreate it in Maya.

Start with a radial array.  A radial array is quite simple, but to then rotate each step, incrementing from one to another, in their local space required MEL scripting. Essentially, I have a box remodeled into the form of the step, then it is grouped twice. I leave the first group at the origin, then translate the second group on the Z axis to a distance equal to the diameter of the main ring in the sculpture. From here I create a radial array using Duplicate Special. In Duplicate Special, I use copy and instance leaf node (so all the steps can be modeled simultaneously). I make as many copies as there are steps, about 71 steps at 5 degrees on the Rotation Y axis. I use 71 because I already have one, for a total of 72. The twist requires the script. I begin the script by collecting all the objects in the selection, so all the steps (the polygon mesh). Then I find the current rotation attribute value, change the value by adding it’s own value with and offset value, then set the attribute with the new value. This enables the user to transform an entire group of objects without rebuilding the array using Duplicate Special.

mls_tempProc();

proc mls_tempProc()
{
	//The value of the increment, floating point 
	float $nX = 5.0; 
	float $nY = 0.0; 
	float $nZ = 0.0; 
	
	//The attribute to change. 
	string $attr = "rotate";

	string $attributeX = "." + $attr + "X";
	string $attributeY = "." + $attr + "Y";
	string $attributeZ = "." + $attr + "Z";

	string $nodes[] = `ls -selection`;
	int $size = size($nodes);

	for($i = 0; $i < $size - 1; ++$i)
	{

	   float $X;
	   float $Y;
	   float $Z;

	   float $offsetX;
	   float $offsetY;
	   float $offsetZ;

	   $X += $nX;
	   $Y += $nY;
	   $Z += $nZ;

	   float $attrX = getAttr ($nodes[$i] + $attributeX);
	   float $attrY = getAttr ($nodes[$i] + $attributeY);
	   float $attrZ = getAttr ($nodes[$i] + $attributeZ);

	   $offsetX = $attrX + $X;
	   $offsetY = $attrY + $Y;
	   $offsetZ = $attrZ + $Z;

	   setAttr ($nodes[$i] + "." + $attr) 
             -type "double3" $offsetX $offsetY $offsetZ;
	}
}

I also made a version using vectors, but I've found this version to be unstable. The Z value will randomly produce huge jumps in value. If you have an idea of how to make this version better, do tell.

mls_tempProc2();

proc mls_tempProc2()
{
	string $myAttr = "translate"; 
	
	//The value of the increment 
	vector $vIncrement = << 0.0, 0.0, 3.0 >>;

	string $selection[] = `ls -selection`;
	int $size = size($selection);

	//to include the first object, use $i=0
	for($i = 1; $i < $size; $i+=1)
	{
		vector $v;
		vector $vOffset;
		$v += $vIncrement;
		vector $vAttr = getAttr ($selection[$i] + "." + $myAttr);
		$vOffset = $vAttr + $v;
		setAttr ($selection[$i] + "." + $myAttr) 
                  -type "double3" ($vOffset.x) ($vOffset.y) ($vOffset.z);
	}
}
Infinite Stairwell

Attempt

At this point, the only thing that can make this better, is if it were adjustable in real-time and animatable.   I'll leave it to Casey to solve the rest.

3 responses to “Iterated Space Transformation”

  1. KC Childers says:

    My almost final attempt at the infinite spiral stair case.

    Stairwell

  2. Matthew says:

    Looking good! Now all you need is the bouncing ball or walking character “climbing” the stairwell.

  3. Matthew says:

    See Casey’s Maya model here: http://vimeo.com/40000252
    in the video @ time 05:14.

Leave a Reply

Twitter

Subscribers

    396