Color gradient on 3D View

Hi Andrew

I have a similar question to this post. What is the best way to visualise a Ladybug analysis in HumanUI?

If I have a gradient of 10 colours the set3D view only seems to take the first colour and applies it to the entire mesh. So I’m assuming I need to use the set3DviewTextured component instead. If I already have the vertex colours from demesh, can I use this as the colour input or do I need to create a texture somehow?


I think my response in the thread you posted answers this question and provides a viable workaround

Hi Andrew

I’ve had another go at this but I’m getting an error creating the bitmap: ‘1. Sequence contains no elements (line: 0)’. Is this because I am feeding in a list of colours instead of a gradient?

Also not sure if I’ve mapped the UV coordinates correctly?

190322 Mesh Vertex Coloring in (270.7 KB)

Yeah, this is not right. You need a gradient for the script and the original values from the analysis, NOT a generated list of colors to generate the mapping. the uv mapping for the coordinates should basically be U= analysis value (mapped to 0-1), V = 0.5 or something similar.

Hi @andheum

I’m still having problems with this. Results from Ladybug are per face, not per vertex. The custom map component is wanting texture coordinates per vertex. Any ideas how to reconcile this?

Would it be better to have multiple meshes, one for each colour and feed this into the HumanUI components as a list or would this be too slow?


I tried separating out the meshes, one for each colour. It works and isn’t too slow (although I’m sure there might be a faster way). As you mentioned in this post, the meshes don’t display exactly the same because the HumanUI viewport is shaded.

Is there any way to change this so that the view isn’t shaded, or a workaround to lighten the colours to approximate the Ladybug colours?

not at present. I have not exposed any control over the lighting in the 3d view - I always intended it to be a supplement, not a replacement for the rhino viewport.

I wouldn’t feed a giant list of meshes into the 3d view component. Try this approach - it does involve exploding the mesh but you re-join it prior to feeding it into hui. (12.8 KB)


If we go down the textured mesh instead of a large list of meshes with separate colours, how would you control the gradient to match ladybug?

Ladybug has a gradient library which returns a bunch of colours used to (re-)colour the mesh. But with the GH gradient editor I don’t believe you can stream input colours, you need to right click and define the preset.

You really have to make everything difficult don’t you :wink:

This is a little hidden, but you can use metahopper to set a gradient object programmatically. The “Value” to set is just a string -


Where T is the position from 0 to 1 on the gradient. Join with newlines so each ARGB color + T combo is on its own line.

Gradient from color (13.9 KB)