Image sampler to assign colours to an array of surfaces

I’ve been revisiting some stuff I was working on back in 2021 but I cannot remember how I did it!

I’ve searched the forum and online but I keep coming up with mesh solutions, rather than surfaces…

Is there a way to take the colour data of an image and apply it to a range of surfaces, rather than meshes?

The images provided are not what I’m working on now, and they were mesh cubes - but it’s advanced a little.

For simplicity, lets assume the image is sampled into square surfaces - but I’d like those surfaces to be coloured specific to the nearest point on the image.

Sorry! Again, I think I might be asking the wrong question and have to check myself when I work it out.



you can preview any geometry with an rgb color or material, the rgb values can come from an Image sampler, example random tiny boxes (they can either be Breps, Surfaces or Meshes, it doesn’t really matter)

the method I use most often is to first drag an image into Rhino (or use the Picture command)
then I reference that picture in GH
at that point, once I have created some points, I do the Surface Closest Point to that Reparametrized surface, in such a way to get perfect UVs directly from the component, and keep the Image sampler Domains [0 to 1] {woth mentioning that all those Points for which you run the sampling, must be contained by the boundary of that Surface}

DiCaprioSampler.gh (1.9 MB)

if you are in Rhino8 you can use the new set of components to bake with Display Color directly, otherwise you must use code or plugins to do that:

2 Likes

Oh Jesus! :joy: thanks for the pointers, it’s been about 3 years since I’ve touched Rhino so forgotten a lot, and it shows!

The python script was a way to bake the info in such a way that it could be exported for the physics bit and then rendered in another program.

All sorted, thanks!

1 Like

Hi Inno,

Here’s one for you… I set up the file as per your screenshot etc and it worked perfectly. I ended up installing Rhino 8 trial. (I don’t use it as much anymore but might end up buying it in 90 days)

Could you explain why it works perfectly with a surface, but when I swap out the surface bits for a hatch it samples the image incorrectly?

please post your file with internalized stuff (also the hatch)

It’s OK - I worked it out… I’d added a join curves node which skewed the image sampler…

Thank you for responding.

1 Like