Mapping Channels
 
 
 

A map's UVW map coordinates channel (or just map channel) identifies which set of an object's mapping coordinates to use when mapping textures to the object. Each map channel has a separate UVW vertex and face list for an object. A mapping channel is associated with a MeshMap object instance.

Different map channels allow maps for the same object to use different coordinates. For example, a user might use one channel for diffuse mapping and a different one for bump mapping. Map channels also let different maps use different coordinates within a compound material, a compositor map, or a multi-material.

Each object can have from 1 to 99 UVW mapping coordinate channels. The default mapping (from the Generate Mapping Coordinates toggle) is always UVW 1. The UVW Map modifier can send coordinates to any of these channels. Each map in a material can use any UVW channel (if present), or other type of mapping that depends on whether the map is 2D or 3D.

Users can set the mapping channel used by a NURBS surface sub-objects in their creation or modification parameters.

The channels are as follows:

There are also two "hidden" map channels that are identified using negative numbers:

The number of hidden map channels is identified by the number NUM_HIDDEN_MAPS but are not counted by the function Mesh::getNumMaps(). In other words the valid channel indexes range from is -NUM_HIDDEN_MAPS to MAX_MESHMAPS-1.

Note the following details on adding map channels:

  1. To support a map channel in a mesh, call Mesh::setMapSupport(channel, TRUE). This works for the vertex colors (channel 0), the texture vertices (channel 1), or the custom channels.
  2. The method Mesh::setMapSupport() allocates the map faces, since there are always Mesh::numFaces of these, but it does not allocate the map vertices, since the number of these can change from map to map.
  3. Use Mesh::setNumMapVerts() to set the number of map vertices.
  4. Calls to Mesh::setNumFaces() also set the number of map faces in all supported maps.
  5. Keep in mind that the Mesh::mapVerts() and Mesh::mapFaces() methods return pointers that may be invalid later if the number of vertices or faces is reallocated. For example, the following won't work:
UVVert *mv = mesh.mapVerts(43); // map channel 43
mesh.setNumMapVerts(43, 98);
for (i=0; i<98; i++) mv[i] = UVVert(0,0,0);