Mesh Color-Per-Vertex Methods

The following methods provide basic access to the Color Per Vertex channel.

Note

In 3ds Max 2, there were only two mapping channels, with channel 0 being used to store either color information or a second texture coordinates channel. For generalized access to all map channels, you should consider using the methods described in Meshop General Mapping Methods

For legacy methods providing access only to the Texture Channel 1, see also

Mesh Texture Vertex Methods

Methods:

getNumCPVVerts <mesh>

Returns number of color-per-vertex vertices as an integer, equivalent to using <node>.numcpvverts

setNumCPVVerts <mesh> <integer> [ <boolean> ]

Sets the number of c-p-v vertices. If the optional boolean argument is true, the existing topology remains intact. If it is false or not supplied, the topology is lost.

When setting the number of CPV vertices using the numCPTVerts property or setNumCPVVerts method, the new verts are initialized to [0.,0.,0.]

buildVCFaces <mesh> [ <boolean> ]

Builds the c-p-v face array after you have set the c-p-v vertex count. If the optional boolean argument is true, the existing topology remains intact. If it is false or not supplied, the topology is lost.

defaultVCFaces <mesh>

Sets the number of c-p-v vertices and c-p-v faces to match exactly the current mesh's geometry and topology and calls buildVCFaces()

getVertColor <mesh> <CPVvert_index_integer>

Returns the color of the indexed c-p-v vertex as a color

setVertColor <mesh> <CPVvert_index_integer> <color>

Sets the color of the indexed c-p-v vertex

getVCFace <mesh> <CPVface_index_integer>

Returns the topology for the indexed c-p-v face as a point3 containing 3 c-p-v vertex indexes

setVCFace <mesh> <CPVface_index_integer> <CPVvert_indices_point3>

Sets the indexed c-p-v face topology from a point3 containing 3 c-p-v vertex indexes

setVCFace <mesh> <CPVface_index_integer> <CPVvert_index_integer> \

<CPVvert_index_integer> <CPVvert_index_integer>

Sets the indexed c-p-v face topology from 3 c-p-v vertex index number arguments

The c-p-v vertex and face indexes are 1-based as with other mesh indexes in MAXScript. Remember that you need to call update() on the mesh after making changes to it for the changes to be reflected in the scene.

Notes

The mesh class contains a list of color vertices which are completely independent of the regular vertices in the mesh. There is no correlation between the number of vertices in a mesh and the number of color vertices. In addition to the color vertices there are also color faces. There needs to be one color face for every regular face in the mesh. For details, see Understanding Texture Coordinates and Vertex Colors topic.

Each color face has three indices into the color vertex array. The coordinates of a color vertex are RGB coordinates, and are accessed as Color values.

The techniques for building and accessing color vertices and faces is virtually identical to the techniques for building and accessing texture vertices and faces. An example script for creating planar texture mapping on an object is shown in Working with Editable Meshes.

See also:

Meshop General Mapping Methods

Mesh Texture Vertex Methods

Understanding Texture Coordinates and Vertex Colors

For more mesh-related methods, see

Editable Mesh - Topics Index

Editable_Mesh : GeometryClass and TriMesh : Value