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)
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.
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.
I couldn’t find the mesh displayconduit from the developer samples. Is there any progress in this matter of speeding the drawing of colored mesh with constant face colors? Right now I’m creating a new mesh from each face and then drawing them one by one in the display conduit. This becomes over 10 times slower than drawing the whole mesh at once. It is a little bit of a problem when I have a mesh with over 10 000 faces.
As part of our plugin we have a postprosessor for FEM calculations. So we will import a fem mesh and the results for the mesh. Some results are only available for each face. So I want to show the result with colors and it should be constant over face. That’s why I need a constant color for each mesh face. As I said in the message above this is done now by dividing each mesh face in my result mesh into its own mesh instance and giving the same color to each vertice of this mesh.