MaterialByElement Modifier

The MaterialByElement modifier lets you apply different material IDs to objects containing multiple elements, at random or according to a formula. When animated, this effect is useful for such applications as an office building at night with window illumination turning on and off at random.

image

Various materials randomly applied to the leaves of the plant

Procedures

Example: To assign colors randomly in a group of spheres:

  1. Create six spheres.

    Tip: One method is to add a sphere primitive, then use Shift + Move with the Copy option, and enter 5 in the Number Of Copies field.
  2. Combine the spheres into a single editable mesh object.

    Right-click a selected sphere and from the Transform (lower-right) quadrant of the quad menu, choose Convert To: > Convert to Editable Mesh. Then click Modify panel > Edit Geometry rollout > Attach List. In the Attach List dialog, click All, and then Attach.

  3. Create a Multi/Sub-Object material with six materials, and specify a different color for each material. image Assign the material to the object with multiple spheres.

    Because sphere primitives are assigned material ID 2 by default, all the spheres now have the color assigned to material number 2 in the multi/sub-object material.

  4. Apply the MaterialByElement modifier to the object.

  5. From the Parameters rollout, turn on Random Distribution.

    Because the default ID Count setting is 2, some of the spheres are assigned sub-material #1, and the rest are assigned #2.

  6. Use the spinner to increase the ID Count setting to 3. Also change the Uniqueness group > Seed value.

    Now the first three materials are assigned to the spheres at random, although with some Seed settings you might see only two different colors.

  7. Keep increasing the ID Count setting until you see all six colors in the Multi/Sub-Object material. The assignments are random, so it might take a while.

Interface

image

Material ID By Element group

The two choices in this group let you create either a truly random distribution of material IDs or divide the assignments among up to eight materials according to percentages you set.

Uniqueness group

Seed

Sets the seed value for the (pseudo-)randomization of material ID assignments. Not animatable.