Paste an image onto a surface

I’m a mathematician new to Grasshopper who is trying to use the ImageSampler to paste an image onto a parametric surface. In my file uploaded here, the surface is a sphere, but that’s just for practice. I need to be able to create a surface from parametrically defined points and then get the colors from an image to go with the vertices on the mesh of the surface.

I have matched the grid of my parameter input to the grid of a rectangle on which I can paste the image without a problem. My formulas create the spherical surface correctly. But when I de-mesh the SrfGrid it has a different number of vertices from what the original grid had.

In the example file, 40401 points go in, but only 39800 vertices are present when I demesh. Seems weird.

Can someone suggest a better way to do this? Thanks in advance for any help.

Best wishes,
Frank


SphereTry.gh (130.1 KB)

Hello
Do you mean texturing or uv mapping of the mesh?
i see your file to get dimensions of the image you can use python

aw

image file.gh (5.4 KB)

1 Like

It’s not a problem getting the dimensions of the image. I can get those easily. The problem is that the mesh constructed from points seems to have the wrong number of vertices.

I tried a Delauney mesh and got better results, attached. Yes, this is uv texture mapping, but I don’t find canned tools for that. An expert told me to do it this way, demeshing a surface and using colors from the image sampler to add colors.

The problem with the Delauney mesh, or perhaps the problem in general, is that it takes quite a long time to update the dimensions. With u and v equal to 200, the image quality is very poor. With 1500, it’s better but still not what I want.

Thanks,
Frank

The Human plugin by @andheum has some tools for texture mapping, so you can avoid having a very dense mesh to get the image resolution.

2 Likes

I would love to see a tutorial on using Human to put images on parametric surfaces. I think your example is a box that you’ve bulged out to make it look round. For my application, I’m working on mathematically defined surfaces.
Thanks,
Frank

Check this post

C# codes contains an obsolete method. It did not create a painted mesh when I ran it, even after I inserted the file path to my own image.

Thanks,
Frank

Did you try Human plugin as @DanielPiker mentioned?

1 Like

Yes, that’s fine if what I want is to paste an image onto a sphere. I’ve been using Photoshop for that. What I need is to put the image on a surface that I have constructed from equations.

I did make a file that uses your advice to put the bitmap onto a meshed sphere and it works fine. But when I try to give it the surface from the file I posted, it didn’t work.

Thanks for trying. I bet that Human will be nice for my application, but only after I figure out this issue with a mesh created by parametric equation.

Thanks,
Frank

While you don’t use the human plug-in yet, perhaps you can use the same point data to get a mesh from points instead of the surface for a slightly ‘faster’ mesh - “mesh from points” is from MeshEditTools, though, which is still a plug-in…

If MeshEditTools ins’t an option then you can regenerate the mesh using the radius/point information:

SphereTry.gh (121.5 KB)

Nonetheless, if the mesh is dense then it’s dense and then you can’t really get away from slowness past 200 points :slight_smile:

'Hope it helps

Thanks! I struggled to install MeshTools and gave up for the evening. I’m in Rhino 6. Tomorrow I’ll try the other idea.

Thanks again,
Frank

You’re welcome!

Here’s the meshedittools component for a quick drag n’ drop* into grasshopper:

Meshedit2000.gha (119.5 KB)

*Make sure to unblock the file once download before throwing into grasshopper.

Best

You can use the ‘Custom Mapping’ component to assign a UV texture coordinate per vertex.
You can use the same parameters you are plugging into the sphere equations here (or any other parametric surface)


SphereTexture.gh (10.5 KB)


parametricUV.gh (11.2 KB)

3 Likes

This is brilliant. It took me a while to notice that you changed 0 to 0.00000001 or whatever to trick the grid into thinking that the singularity isn’t there. I think this would not allow me to compute the volume of the mesh, right?

My next step is to learn how to bake the preview so that I can render it in Rhino. I’m studying the materials component and the bake component, but need to keep learning.

Thank you so much! I really appreciate all the help I’ve received in a short time.

Best wishes,

Frank

1 Like

Thanks for pointing me to this plug-in. I’ve learned a lot today.

Best,
Frank

I’ve been using this very helpful method, but have run into a problem. I can see the texture on the surface and when I change the view to Rendered, it shows up fine. But when I push the render button, it does not add the texture map. I can see under the Textures tab that the file is there and assigned to the object.

I’ve just updated to Rhino 6.28.

6BandsNotRendering.gh (33.6 KB)

I’m circling back to this after a couple of years. When I try to open this file, it says it’s missing the component Mesh FromPoints from a plug-in called MeshEdt Components. I can’t find that with the PackageManager and it doesn’t seem to come up in the help search. Any advice?

I really loved using this. Thanks in advance for any help available.
Best,
Frank

Hi @ffarris

That component is from MeshEdit | Food4Rhino

One of my projects just needed this - so thanks very much - i searched for quite some time… However when i do a nice render, the image doesn’t show…

Left is the rhino highest quality render and the right one is the basic render.

Am i missing an option or setting?