Notifications
Clear all

[Closed] Poly Vertex Color

Maybe I just missed something, but how in the heck do you access and manipulate vertex colors in a Poly object? its seems easy and well-documented for Mesh objects and Vertex Paint modifiers, but I can’t for the life of me find the commands for Poly objects.

I really only need to be able to read the vert color, but it’d be nice to know how to set vert colors also.

Additionally, how do you access Vert Illumination?

2 Replies
1 Reply
(@bobo)
Joined: 1 year ago

Posts: 0

It is pretty straight-forward.
Since an EPoly can have polygons with more than 3 vertices, the method GetMapFaceVertex() returns the Map Vertex index corresponding to the Nth vertex inside a face.

For example, if you create a Box, assign a Vertex Paint modifier, paint some fancy colors to the vertices and collapse to EPoly, you can do the following:

$.GetNumMapChannels() –returns 2 because you painted in channel 0, and channel 1 also has UV data
$.GetMapChannelActive 0 –returns true, because we painted in Vertex Color channel
$.GetMapChannelActive 1 –returns true, because a box has UV coords stored there
$.GetMapChannelActive 2 –returns false, because it has not been enabled
$.GetMapChannelActive -1 –always returns true, this is the Illumination channel!
theCount = $.GetNumMapVertices -1 –returns 8 for a box
for i = 1 to theCount do format “% %
” i ($.GetMapVertex -1 i)
1 [1,1,1]
2 [1,1,1]
3 [1,1,1]
4 [1,1,1]
5 [1,1,1]
6 [1,1,1]
7 [1,1,1]
8 [1,1,1]
–this is because Illumination is always set to white by default.
–Change a vertex Illum. data and run again to see the changes.
–But the Illum. channel has one value per corner, while Channel 0 where we painted has 24!
theCount = $.GetNumMapVertices 0 –returns 24
–So if you want to know what is the color of the forth vertex of the third polygon in the Box,
–you have to say

theMapV = $.getMapFaceVertex 0 3 4 –returns 11 which is the index of the corresponding Map Vertex
$.getMapVertex 0 theMapV –returns the color in that Map Vertex, which is thus the color
–of the 4th vertex in the 3rd polygon.


Note that if you ask for vertex 5 of a quad, it will return -1 because there is no such vertex. You can use the EPoly methods for finding the number of vertices in a polygon to get your loops working

Hope this helps!

Awesome Bobo, thanks alot.

Seems pretty basic and easy. I’ll give it a try later.

Thanks again!