Modifying the Actor's Materials and Textures

 
 
 

When you import a model as an actor in CrowdFX, the materials that are set on its clusters are converted to ICE materials in an ICE tree on its envelope mesh. Here, a Material ID is assigned to each source model cluster's material.

The Mesh Proxy object makes a copy of the source model, keeping the model's material and textures. The Actor Copies mesh then gets the material and texture data from the Mesh Proxy object and creates copies of it so that each instance of the actor in the crowd simulation uses the same material and textures as the source model.

Modifying the Source Material after Importing the Actor

In the Mesh Proxy object's Set Mesh Proxy compound, the Copy Material Attributes option is enabled by default so that the source model's material is automatically propagated to the actors in the crowd who are instantiated from this source.

This means that if you make a change to the source model's material, it is immediately used by all the actor instances that reference that model.

Varying the Actor's Materials

There are many different ways in which you can vary the materials on actors. A simple way is to duplicate the same source model several times and import each one to create different actor proxies in the crowd simulation. Then change the material colors on each source model (such as the color used for the face, hair, shirt, or pants).

You can also create multiple materials for each cluster on a single source model, then create an ICE tree on the Actor Copies mesh in which you decide which materials are used according to a condition you have set up. You can set up the conditions using any of the standard ICE nodes, then use the Material (Topology) nodes to set the materials used. For general information on using the ICE Material nodes, see Applying Materials in ICE.

In the following example, two extra materials are created for the shirt cluster of the same source model. Which color of shirt is used for the actor depends on the emitter ID. Of course, you can create any condition you like for selecting or randomizing the materials.

Using this example, here's what you generally need to do to use a variety of materials on an actor:

  1. Create multiple materials on the source model. In this case, the shirt cluster has two extra materials.

  2. On the Actors Copies mesh, create a new ICE tree in its Modeling region.

  3. In this tree, get the different materials you want to use, reference their data in an array, then set the Materials data.

  4. In the same ICE tree, create the conditions for when each material will be used, then set each material's Material ID.

    In this example, the emitter ID determines which material is used on the actors.

Modifying the Texture Projection for an Actor's Texture

By default, the textures are applied to the actors using the same clusters as the source model. However, the texture projections on the source model's clusters may have different names from what's being referenced by the Actor Copies mesh.

This source model has a texture applied to his body cluster. The hair is a separate cluster.

The references to the source model's material and texture projections are locked in the Actor Copies mesh's Duplicate Mesh Proxy compound, which gets its data from the Mesh Proxy mesh. So to fix the texture projection reference, you need to update it on the Mesh Proxy mesh.

  1. In a render tree, check the name of the texture projection used by the source model's material.

  2. In the Mesh Proxy's ICE tree, open the Set Mesh Proxy compound for editing. This compound is referenced by the Actor Copies mesh's Duplicate Mesh Proxy compound.

  3. Open the Copy Texture Projection from Source compound's property editor.

  4. In the Source Name field, use the explorer to select the texture projection attribute (such as UVWs) used on the source model so that the Actor Copies mesh is referencing the same texture projection as the source.

    The textures now appear correctly on the actor instances.