Mesh Face Coloring


What is the most efficient approach to mesh face coloring for a large mesh (say 50,000 faces or more)? Each face will be painted a solid color based on user-defined information. The approaches I have considered so far include:

a. Display conduit in which I draw each face as a polygon with a specific color (first attempts at this seem to be very slow).
b. Add redundant vertices to the mesh so that each face has its own set of 3 or 4 vertices and set vertex colors (seems less than ideal).
c. Break the mesh up into separate meshes with common face colors (additional bookkeeping to track the “child” meshes)

Any other ideas?

Thanks, Larry

(Dale Fugier) #2

Hi Larry,

If possible, I would just use a display conduit. Here is a C++ sample to draw a face-colored mesh.

If you run into roadblocks porting this to RhinoCommon, let me know.

– Dale


Thanks Dale. I’ll give that a shot.


(Steve Baer) #4

Wow, that is a really long and hard path to take to draw colored mesh faces. I can see why Dale’s sample is written the way it is, but we should really try to come up with a better solution.

@jeff, I’ve seen this request for drawing each face of a mesh as a different color before. We may want to think about a way to add this functionality to the V6 display SDK so a set of “face colors” could be used instead of vertex colors.

Larry, I would go personally go with the approach of adding redundant vertices where face colors need to change. You could optimize this by only adding vertices where the color actually needs to change instead of blindly adding vertices for every face. This is going to draw a lot faster in a conduit than looping over each face and calling DrawFace.


Steve, thanks for the reply. I wanted to make sure I correctly interpreted your last statement, “This is going to draw a lot faster in a conduit than looping over each face and calling DrawFace.” Are you suggesting I still somehow use a conduit for adding vertices? I was thinking the multi-vertex approach would forgo the conduit entirely.

(Steve Baer) #6

Hi Larry,
I just thought you were working in a conduit to perform some sort of temporary analysis display. Yes, if you use the multi-vertex approach, you could completely forgo the conduit when it makes sense to just have the mesh in the model.


@dale, the link above is broken. Is the sample still available someplace?


(Dale Fugier) #8

HI @rene_hiemstra,

All of the developer samples have been consolidated here:

– Dale