Mesh color visualization

Hi @dimitrie,

I am looking into ways to visualize our mesh in the Speckle viewer with colors. Based on this example stream, I was able to do some basic coloring of my very simple structural model:

Though this works quick and simple, it’s somewhat limited, as I can only assign the colors once, in this case via the Python API. It would be more useful if we could use the available filter in the viewer, to dynamically show colors based on properties assigned to the mesh (vertices), as discussed in this topic, but for Speckle v1. However, this doesn’t seem to be an option in v2. I can use some properties of the 2D objects to color the mesh (see below), but I cannot use properties within the mesh, as these simply aren’t available for filtering.

To experiment with coloring based on the mesh, I added a displacements attribute to the mesh, that has 4 randomly assigned ‘displacement values’ between 1 and 10, that correspond to the structure of the 4 vertices in the mesh objects. However, the displacements attribute doesn’t show up within the available filters. So my question is: Did I do something wrong in the process, or is this simply not a supported workflow within Speckle v2, and if not, how can I make coloring based on mesh results work in another way then?

You can find the commit including displacements here (invited you to the stream). The meshes with displacements can be found in the Shapes container:


Hi @Rob! You’re right, we currently don’t support vertex colouring by other properties as we did in 1.0. This is something we’ll add to the backlog for the viewer.

Nevertheless, @connor did some amazing things with 2.0 that you can check out here: GitHub - connorivy/RevDesign.

I’m sure he’ll be more than happy to provide some extra tips/guidance when he’s online/has some free time!

1 Like


I wanted the exact same thing that you do. What I ended up doing was modifying the viewer (specifically the filtering manager) to add a new type of colorby filter called FEM. From there I call the ‘colorFloorsByVertices’ method that I made and that is where most of the magic happens. You can definitely look there to see how to do it for your project.

My code isn’t the cleanest and there aren’t really any comments :sweat_smile: so let me know if you don’t understand something that I did. Hopefully we can quickly develop a more general solution so people can use vertex colors by other properties without having to create their own version of the viewer.


Cool, looks good!
I’ll have a look into this, see if I can test it a bit.

Also good to hear it’s on the backlog, believe it would be an interesting use case for us, being able to visualize any results that are appended.

Had a look at your code and README, in the end wasn’t able to make it run fully
At least I have some things to improve for your README:

  1. The biggest improvement would be to reference the right repository, not the MapThat repo :stuck_out_tongue: :
    At least I was surprised with the result when running the server, which was also nice.

  2. It seems your missing some requirements; optimesh and sfepy, of which sfepy isn’t particularly easy to build. In the end I cloned it from the Github repository, but this also gave issues, as this requires to build it locally which at least I didn’t succeed in, and therefore I was missing some references like CMapping. So not really strange that it didn’t work in the end.

Anyway, this is work in progress so makes sense that there are some loose ends. At least nice to see the example running on this specific use case! Looking forward to a generic implementation of this, indeed without local server manipulation.