How to best Refining a Mesh with Interpolated Vertex Colors

I’m trying to subdivide/refine a mesh, and I want the colors of the new faces to reflect an interpolation of the vertex colors from the original mesh.

something like this although a more pixalated version is also fine

I started under the assumption that the component “MSmooth” could do this, but it didn’t—and here I am, down the rabbit hole! :wink:

I’ve worked with a AI-assistent to create a Python script to attempt this. While I’ve made progress, I ran into several challenges:

  • Vertex color assignment: Ensuring vertex colors are properly interpolated and applied.

  • Handling face indices: Errors or inconsistencies when accessing or mapping the subdivided mesh to the original.

  • Has anyone worked on a similar problem and found a better, faster, or smarter approach to refine a mesh while handling color interpolation effectively?

Another method i tried, based upon averaging colors of nearest vertices. Although i assumed this would look better, it’s more like a blur effect with the original resolution and when i try it on the refined mesh (matching the vertex and color count), the order is mismatched
example_2.gh (124.9 KB)

For context: I’m using Ladybug to run an analysis with a certain grid resolution. To create a ‘cleaner visual representation’ for presentation purposes, I’d like to refine/subdivide this mesh. Directly increasing the grid resolution itself significantly increases computation time to get the same result (i need to run many analysis).

Any tips, examples, or resources for correctly implementing color interpolation on meshes or managing this workflow efficiently would be greatly appreciated. Thank you in advance!

I would not advise to do this. You should not compute on a coarse mesh and display results on a finer mesh. Look into Gaussian Blurring.

Hello
in your mesh colors are not really on vertex but on face. There are 3306 faces and 13224 vertex (3306 x 4). It
seems there are more tools that can deal image than meshes. I have a little tool in Nautilus that can read a mesh and transform it to an image and mesh (with color on vertex or face). But It didn’t work on this type of mesh as input. I’ll try to improve it.

But it seem possible to extract the colors and then transform it to an image with Bitmap plugin. But there is magic here as image as levels it is not simple to get a better image. It could be better to work with initial numeric values.


mesh to image resample.gh (116.5 KB)

1 Like

interesting approach, i’ll dive right in to this