Hi folks, I’m trying to write a Grasshopper process to create a halftone image with custom shapes – I’ve found a tutorial at ParametricCamp to do so with circles, but I’m having trouble figuring out how to do it with a custom curve. Anyone know a tutorial/process I can look into? Here is what I have so far: halftone V3.ghx (332.2 KB)
Any direction is appreciated, I’m still new to Grasshopper so apologies for what may be an obvious question . . .
instead of a Circle you can use whatever shape you like centered on XY and Orient it: in case it’s a basic shape that Grasshopper can draw, you can take advantage of the “element scale” slider to scale it up/down at will:
if you want to use a custom shape of your choice, you can draw it centered on XY and link it to a Curve parameter, like I drew this weird thing centered on XY:
Works great, I included the ‘Boundry Surfaces’ component to help the image visually and a few notes to myself as I revisit it. Thank you for the help!
Any recommendations on how to deal with the image wrapping (noted in the yellow boxes)? I’ve tried to get my head around how to coordinate the grid size and cell number sliders to eliminate it, but haven’t had success yet.
the method I use the most is to reparametrize both the point array and the image into UV domains ([0,1],[0,1]) which means that you will need to create an array of points that has the very same proportions of the image otherwise it will look weird
the whole point of this is to draw a surface that contains all the points you want to sample (bounding box → Surface) then get the UV coordinate of the Closest (sampling) Points to the Reparametrized Surface
because the Surface is reparametrized, it has both UV Domains [0,1] → and because the surface extends along all your sampling points, they will also inherit UV → XY coordinates in the same Domain [0,1] → last step, in the Image Sampler, set the Domains of the image also “0 to 1”
as I was mentioning before, the downside of using this is that you have to take care the Point Array has same proportion of your image let’s say I do something weird like this, increasing horizontal size and maintaing height as it is, I would end up with something stretched like this:
just a note -it happened a few days ago, it’s still in my RAM- in case you can’t cast Bounding Box (Flat box) into a Surface directly (Surface component turning Red, probably Rhino7), you can try this instead:
Fantastic, thank you again. This really helps me get my head around the concept of ‘Reparametrization’.
My next task is to be able to tune the ‘contrast’ of the halftone pattern, ie, adjust the difference between the largest and smallest elements to various degrees. I tried squaring the scale factor (see below), although this feels very brute-force and doesn’t give a fine-tuning ability. The other option may be to just adjust the contrast of the original image in Photoshop prior to importing it. Anyone have a more elegant solution than mine?
you can first Remap the values, then use Graph Mapper to define a certain function behavior, and finally you can use a multiplier to give those their final size
Remap normalizes your values that were in the range [0.67, 1] into a Range [1, 0]
Graph Mapper takes values in Domain [0, 1] (you can also customize to whatever scale you want by double-clicking it, but in my opinion it’s more practical to keep it [0,1] when possible)
the final Scale+multiplier is useful to just scale everything up/down depending on your initial Curve
Just note that the lower point of the curve defined by the Graph mapper is not a real zero but it’s a tiny tad more than that: this because if a value gets to zero, then that value is multiplied (zero times whatever still = zero) and then it’s used as Scale value, where zero will make the component turn red with an error (scale by zero means nothing gets output)