Animating Abstract Patterns

Scene formed of XGen 'archive' cube primitives. A texture map drives the 'length' attribute and an expression drives the 'twist' attribute.

 

XGen is a powerful tool that offers many creative opportunities for positioning an arbitrary number of primitives either randomly or uniformly placed. You can use texture maps in combination with XGen Descriptions to specify the location and density of primitive generation as well as to control the number of primitive attributes.

This tutorial will show you how you can very easily use a texture map to 'drive' the length of an XGen primitive. These primitives can range from spheres, splines or as in the example below, cube geometry that has been exported as an archive. We will then use the $frame expression to animate the length of the archives. Finally, we will talk about how to batch render the animation using XGen and MtoA.

 

Icon

A video tutorial that goes through this process can be found here.

 

Primitive Archive

  • Start off by creating the polygon cube that you want to use as the XGen archive. Leave the cube's scale at 1,1,1. We will adjust this later with the XGen Size attribute.
  • With the cube selected go to XGen>Export Selection as Archive(s)...
  • Rename the Archive Name to cube and choose where you want to save the archive file.

 

XGen Description

  • Create a polygon plane. We will use this plane to assign the XGen description. If you want the formation of the XGen primitives to be circular then make sure the Subdivisions Width and Subdivisions Height are set to 1. If you want the formation to be square then increase the Subdivisions Width and Subdivisions Height to 10. In this example we have set them to 1.

 

  • Select the polygon plane and go to XGen>Create Description. This will open up the Create XGen Description below.
  • Choose Custom Geometry/Archives. Leave the other default settings alone and click on Create.

 

  • It is good practise to lower the Percent value in the Preview/Output tab before continuing. If the Percent value is too high you may find that your computer will stall due to the large number of primitives generated.

 

Twist Expression

  • Under Primitive Attributes, click on the downward pointing arrow   to the right of the Twist slider control. 

 

  • Select the following from the menu:

Load Expression>samples>Geometry>flatten_Room

 

You should see Width and Depth attributes appear under Twist. Increase the Twist Width to at least 200.

Density

You may need to change the Density value depending on the values that you have used in the Expression Editor. If the cube archives are too densely packed together, you may want to reduce the Density value. Conversely, if the cubes are too far apart, you may need to either increase the density or decrease the maximum width size. The images below show the effect that increasing the Density has on the number of primitives created by XGen.

Density 35000.0

  • Doubling the Density value to 70000.0 produces the image below.

Density 70000.0


Length

We can control the length (height) of the cubes using a combination of texture maps and expressions. We will start off by creating a texture map to control their length.

  • Click on the downward pointing arrow   to the right of Length. Select Create Map... (it is important to note that this will only work if the plane has a Maya shader assigned to it).

 

  • The Map Name should say 'length'. Increase the Map Resolution to around 200. This sets the resolution of the PTEX map in texels per-face. When using high resolution textures, use larger Map Resolution values. After you have done that, click on Create.  

 

Create a texture map

Now we want to add our texture map. Click on the paint icon to the right of the slider control . You should see in the Hypershade and Node Editor windows that a file texture has been connected to the plane.

 

  • Select the file texture and open the texture map that you want to use to drive the length of the cube primitives. Make sure to choose a texture map that has a lot of contrast and whose features are recognisable even at a small size. Too much incidental detail in the image will not transfer across well to the cubes. 

Black and white texture used to drive 'length' of cube archives (map used for top page image).

 

  • Before we render the scene we must first tell XGen to update the file texture. Do this by clicking on the  disk icon for each length, width and depth attribute. Create a light and render the scene.
Icon

Remember to select the disk icon after updating the file texture used to define the primitive attributes, otherwise XGen will not update it and the render will not change.

 

Length Expression

  • Next, click on the Expression icon   to the right of the Length slider control.

 

  • You should see the following length expression text in the Expression Editor. In the Expression Text Field you should see the following text:
$a=map('${DESC}/paintmaps/length');#3dpaint,200.0

This is used to define the length attribute using the texture map and 200 is the Map Resolution that we defined earlier.

 

  • Add the following line in the Expression Editor. 
$a=20*$a+1; 

...where 20 is the maximum length of the cube archive and 1 is the minimum size. Your length Expression Editor should look like the following image. Copy the expression text. Click Accept when you are done.

 

  • Paste the same expression that we used for the length here. Do the same for the Depth attribute.

Animation

We can use the $frame expression in order to add some animation to the length attribute of the XGen cube archive.

  • Open the Expression Editor for the length attribute and add the following in the Editor window:
$a=map('${DESC}/paintmaps/length1');#3dpaint,200.0
$a=20*$a+$frame+1;
$a 

 

You may want to increase 20 to a higher value such as 40 in order to increase the size of the length attribute. Click on Accept. You should see that a slider called Frame has been created:

 

  • Go to frame 1 in the Time Slider. Right click on Frame and choose Set Key. You may need to use a negative value so that the cubes start off with zero length.
  • Go to the end frame (for example 100) and create another keyframe for Frame (something like 25). Scrub through the Time Slider in order to view the animation. You should see that the cubes seem to grow in length during the animation.
  • You can also try keyframing the Twist Width attribute to see the cubes twist into interesting formations. The example below uses values between 200 and 600.

 

Batch Render

Icon

Currently MtoA will not correctly batch render a scene that contains XGen with animation. Instead you will have to export an .ass file and render it using Kick. More information about kicking .ass files with XGen procedurals can be found here. This will be fixed in the next release.

Remember to do the following steps prior to batch rendering otherwise the XGen description will not render:

  • Save the scene.
  • With the geometry and XGen description selected go to File>Export Patches for Batch Render from the XGen description menu. If the XGen description has animation, enable animation and choose the Frame Range.
  • Save the scene.
  • Once you are happy with how the animation looks, you are ready to set off a batch render animation.

 

Conclusion

That concludes this tutorial on animating formations of XGen primitive archives with texture maps and expressions. This is just one example of what this powerful tool is capable of. Try experimenting with different texture maps and primitive types such as splines and spheres. Below are some further examples using various textures connected to the length attribute.

 

Example Renders

 

 



Thanks to Pedro Fernando Gómez for his assistance with XGen. 

  • No labels