Pixel_Waves Node
Last week a Nodebox user, Ari, asked how to make wavy line art. His example showed a photograph formed by sine waves that stretched out to render light pixels and scrunched up to render dark pixels.
I provided a quick and dirty solution which did a reasonable job of this, but then became more interested and decided to do the job right and make a more robust and flexible node.
Pixel_waves takes three inputs:
- Pixels. A list of shapes that can serve as pixels to convey size, position, and brightness. This is normally an array of colored squares, like the output of my image node, but in theory it could be most any set of shapes.
- Wave Type. The choices are Sine, Square, Sawtooth, or Triangle.
- Break on White. Check if you want to treat white shapes as blank space and use that space to break rows of waves into separate paths. If unchecked, white pixels will be rendered as a slight undulation to create a very light pixel.
The node returns waves of various periods joined together into one wavy path per row (or between breaks if the break option is checked).
The attached demo shows two use cases.
The first case shows a photo (of me in Amsterdam). The output of my image node is ungrouped into separate pixels and fed directly into the pixel_waves node. Since the image was set to a relatively high resolution, it may take Nodebox 30 seconds or more to complete the render. When experimenting with photos I recommend starting with the low resolution settings while you experiment with the various image and wave options.
In the second screenshot, the word "Pixels" is fed into my pixelate node to create a pixelated word. Those pixels are then ungrouped, fed into pixel_waves, and re-colored to show the segmentation of wave paths around blank spaces. The pixel_waves node attempts to choose an appropriate stroke width for the waves (relative to pixel size); if you wish you can darken or lighten the waves by increasing or decreasing storkeWidth.
I'm still not sure how useful this node will be. I would think it might be useful to the NodeBox plotting community, since it makes phtographs easy to efficiently draw on a plotter. I hope some Nodebox plotters out there will try this node and give me some feedback.
You should also be able to produce some interesting effects. I have already made several animations. To show off the wave effect you may want to scale your image to use larger pixel sizes and strokeWidths. I notice that PDFs of high res photos did not print well, perhaps because Nodebox has problems rendering PDFs with fractional stroke widths. PNGs, if scaled up, seem to do better for printing.
I have not yet played much with other wave types or more unusual pixel shapes. As always I would be excited to see other people's experiments.
Note: I'm not sure if I should keep adding nodes like this to my library, which is already intimidatingly large. Whether or not I do may depend on how much feedback I receive about this node.
-
pixel_waves_photo_screenshot.png
2.65 MB
-
pixel_waves_pixels_screenshot.png
880 KB
- pixel_waves_node.zip 409 KB
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac