Dynamically coloring Mesh objects

Hi,

I’m trying to display some energy simulation results in speckle. I have a bunch of meshes making up the building, which belong to various zones, and each zone has an energy value which I will be mapped to a colormap and used to color all the meshes which belong to that zone. However, I also have various simulations for the one building, so I’m not sure what structure to use to represent this. Ideally it would be possible to flick between the various simulations and see the zones change color between them.

Is there a way this can be done without creating a new mesh object for each color option?

Hello @tluther! Yes, you can :slight_smile: I’ll use this stream as an example - it links to the viewer. See below:

How this works: each object (mesh) has a set of custom properties that are a bunch of arrays with values in them, one value per mesh vertex. The viewer will then try and colour things by this property (doing a min and max bounds on all the values), and assigning a vertex colour. You can switch between them afterwards like in the gif above.

Here’s how one of those meshes actually look like data-wise:

As you can see, properties.structural.results.a1.etc.ux, as well as *.uy, etc., are arrays with numbers.

I’ve just realised you probably don’t need all that, if there’s only one value per object. In that case, make sure it’s a string and then you can easily just group by it in the same menu as the animation above, so you can flick through various “energy zones”. See this:

https://speckle.systems/_nuxt/img/5e491e6.gif

This is if I’m understanding your use case correctly! It’s ripped off from the docs actually, which would be a good read: https://speckle.systems/docs/basics/viewer

thanks dimitirie, that works great

1 Like