I am trying to map an image over front faces of these cuboids. i want the whole image to be projected individually on each box and whatever part of image falls on that part of face to be applied on its face and not the whole image like this -
I am not sure what you ask is what you want. Image Sampler is used to get a color at a specific position of the image.
As you seem to want an image projected you want, you surely need a texture. The most simple is to use Rhinoceros and set texture coordinates to the boxes.
In Grasshopper I don’t know a tool that can set texture mapping to Brep. For mesh you can use Nautilus or Flexibility (it projects on a box, not along a direction) or Human.
Flexibility is more simple.
In Nautilus you must have a sort of master mesh with UV, I used the bounding box, the use the coordinates to set UV between [0,1]
and the higher you set the resolution, the longer the script takes to execute. For a per-pixel calculation, it took 2 minutes.
Much to my chagrin, I found out at the very end od the script, that when you merge meshes they lose their vertex color assignments meaning this whole script was for naught.
Thank you for informing me of this. I tested and can verify it is true. Even in writing that the joining of meshes rid the meshes of their vertex colors, I thought there must be some caveat to this. I have updated my script above, and also provided Import Image with a smaller sampling resolution so that the file does not surprise you with a two minute loading time.
This was my first time using the Mesh Spray and Mesh Split Plane components. I have to say, as I was contemplating how to split the image mesh, I was looking through the Mesh > Utilities and Intersect > Shape Panels and was underwhelmed by my options. Initially I set out to split the meshs by Mesh Intersection. When this failed, I turned to using Mesh Split Plane. In hindsight, perhaps my attempt with Mesh Intersection would have worked if I had not been trying to intersect open meshes in the same plane, i.e. intersected the image mesh with box meshes.
Mesh Split Plane is troublesome because unlike, say, the components Trim with Region and Trim with Region(s), Mesh Split Plane does not have a counterpart that allows splitting of a mesh by multiple planes. It forced me to split the image mesh by planes in a loop. A Mesh Split Plane(s) component would be useful, especially if instead of Above and Below outputs, the component would deliver an Index map of the planes used to create a particular split-piece of a mesh.
I am slowly learning about how the points and vertices of a mesh are different things and that vertices unlike points also store information on color, UV coordinates, and normals. In your script, in the UV remapping of vertices, the UV from Mesh to Meshes component outputs invalid meshes:
Why does this happen and why is it unproblematic? Also, say if I wanted to apply two different images to the boxes; a logo on the front, and different logo on the back. How would I go about doing this?
is there a way, where i can bake the image i see in custom preview into rhinoport? i have to send each individual box to the manufacturer. how do i do it? i cant use vectorize because i might later need to print an image which may not be properly vectorized by vectorize plugin
Hello
I am not sure I understand, because at the end there is no need to use Grasshopper for that.
In rhinoceros an object could have a texture. I don’t see others ways except having some fine meshes with colors on vertexes !
So if you want mesh from Grasshopper, graft input of “UV from Mesh to Meshes” then bake the output of mesh union
Make a material in Rhino with the Image you need, then assign this material to the objects
But all this process can be done more easily in Rhinoceros
Make the box with array, then apply a planar mapping !!
If you want better answers try to be more precise and also learn how the tools works.
What formats are accepted by manufacturer ?
Did you see that mapping is goin through the object ? Is it a problem ?
Manufacturer of what ? Is it 3d printing, just image printing … ?
I’ll have to dig on the invalid mesh. I think it is not a problem because it is an empty mesh (no vertices, no faces …). In my tool MeshTo is exploded at unwelded edges.
Box have 48 vertices and 36 faces. The output of “UV from mesh to meshes” generates meshes with a total of 36 faces. So all faces are there ! But I suspect that in the original mesh some points are shared among faces and some aren’t !!
Ha! It cannot be known
I meshed it the same way you did and also used Simple Mesh and it didn’t work—yet the Mesh Brep still produced the same-but-not-the-same mesh
I have tried to project the image onto surfaces which are in different planes. but im getting invalid meshes onto which the image is not being projected properly as you can see in the image. i have attached my gh.file here -