Image Sampler Not Scaling Correctly

I am creating a metal screen perf pattren using the image sampler. I have an image with black, gray, and white:

I have drafted rectangles in rhino for the individual panels that will be fabricated. I then made sure in photoshop that the image correctly aligns with the rectangles:

After running the image mapping script on a surface, the grid of points is offset in the x axis like so:

Image sampler set to 0 to 1 domain in both axes. Surface is reparameterized.

First question is how can I align this. Second is is there a better way going about this - is there a way to use the image sampler on multible surfaces? (the next issue I will have is the shapes need a 1" border around each panel).

Magnolia Oxford Metal Screen Script for fourm.gh (2.3 MB)
Metal Screens Rhino inside Revit.3dm (16.7 MB)

i think the imagesempler works corectly. but the image does not fit the geometry.
imageSamplerTest.gh (4.4 MB)
to use the same imagesampler for several surfaces _each surface showing a different part of the image you could set the parametrisation of that surface to a part of the imagesampler interval.
Surface.SetDomain method

I work a lot on stuff like these (for various reasons… DeDots - AleInno Design )

I see you are trimming the jpg image to be sampled, in such a way to have image areas that are somehow already on their own following the shape of your final panels: I do advice against that :slight_smile:

I always get much better results by allowing the points in GH to define the project area, and treat the whole image as canvas with extra content that can be sampled anywhere, like this:

which means to “untrim” the jpg image, in such a way there will be white_pixels_of_flowers also outside what you assumed would be the boundary of each panel (because there will most probably be)

the other thing I would note is that when you define your “basic grid” for Orienting the leaf pattern, if that basic grid does not already perfectly fit inthe boundary of your panels, then also the leaf pattern won’t

here, already at isotrim, you see that the grid is off alignment:

this means that you won’t get a good alignment from the very start


best way to do it: first in Rhino use the DIR command in such a way to make sure all the UVs of your surfaces flow in the same direction, from this:

to this:

then isotrim similarly to what you have already done, and then take care of replacing the image file with one that does not have panel trimming as explained above

and also consider that you can’t have scale at 0%, so this left point of the graph mapper should never go to Y=0

these vertical rows of tiny scaled leaves are the byproduct of using an image with divisions:

replace the image and those will be gone :+1:

Magnolia Oxford Metal Screen Script for fourm_inno.gh (2.3 MB)

surfaces are internalized, no need to post 3dm file, but you might want to relink them to your own Rhino file eventually

Random example based on a different pattern:

This is perfect. Thank you!
Follow up question on your script: When I re-link my surfaces compared to your internalized ones, I get a “box” instead of “flat box” from the bounding box componet - all my surfaces are at 0 in the z axis and both use the world xy plane. Anything else you did besides the DIR command to the surfaces?

make sure you didn’t select any “extraneous” surfaces, make also sure you didn’t select the big surface that encompasses all the single panels:

I’m not experiencing that in R8, in R7 you might need to extract the bottom face of the Bounding Box with something like Deconstruct Brep + List Item

Ok interesting. The top level was working but the bottom wasn’t so replaced them. Working fine now!