Tuesday, January 24, 2012

Patterns, Part 2

Back in 1993, I tested a special capability that, unfortunately, has since disappeared. It allowed you to devise patterns that used a set of basis tiles, so that each tile could be chosen from this basis set. I call these tiling grammars.

At the right is an example of such a pattern. When I write pattern, I mean a non-repeating arrangement of items taken from a small set.

In this case, you can easily see how a space-filling curve can be generated from a small set. But what isn't really obvious is that this image is made by randomly placing square images into a grid.

Each grid element can have one of two images in it. With this image, I have taken care to create an image that (almost) doesn't have any obvious loops in it.

Well, OK, it does have one, in the lower left corner. But it doesn't have any circles in it. That, it turns out would be legal in this particular pattern grammar. Loops (and loops within loops within loops) would also be legal.
Here is the basis set for this particular image. It consists of two tiles as you can see. In each square, one tile connects the middle of the top edge with the middle of the right edge and also connects the middle of the left edge with the middle of the bottom edge. The other tile is either a mirror-symmetry of the first, or it is rotated 90 degrees from the first, whichever you like.

But wait, there are more options along these lines. For instance, I can create two more tiles that connect vertically and horizontally. In one tile, the horizontal crossing takes precedence, and in the other, the vertical crossing takes precedence. Now what would happen if we randomly expressed a tile from this basis?

Well, we can easily generate this test as well. Here, to the left, we see that suddenly, this image is starting to look like a subway map.

This grammar can generate interweavings of any kind. Weavings are made of warp (vertical threads) and weft (horizontal threads). Since one element is warp-over and another element is weft-over, we can represent all possible interweavings.

But what makes this interesting is that the threads can also turn.

You can represent knots as well, of course, since we include pass-under and pass-over elements.

Suddenly, this pattern has taken on more dimensions than before. Just 4 elements and so much richness of representation!

I thought on this, and realized that I could also include ends: threads that do not cross the tile, but rather end. I increased the basis by 4 more tiles. This time, the four diagonal sad-faces were added.

It is not obvious to me what this grammar will generate. But I think it's going to be interesting nonetheless! This seems to leading to noodles and other patterns made of threads that have ends. What will it look like?

Here is an example output randomly from this grammar. The most interesting part is that the complexity has definitely increased. Notice that the threads seem to look like bacteria in a culture mold. But regular, of course.

One obvious thing is that dots have appeared. And letters, like lower-case f and t.

You can identify each thread by itself, and where it goes.

And yes, a sad face has appeared in upper right.

After making this, it occurred to me that it would be possible to add 3 more elements to the basis. A tile containing 4 ends, and horizontal and vertical crossings with ends on the other sides of the tile.

Here is the new basis set, with the three new tiles added.

Perhaps the new elements look like the division symbol. But with the interconnections, this will likely be obscured by the neighboring elements, hiding it.

One thing we can say just by looking at the basis set: there might be more dots than in the last generated example. And more vertical and horizontal lines, particularly those which have no other line crossing them. So this will undoubtedly lead to more open space in some areas.

Here is the result of generating a random placement using this new basis set.

The result is using fewer and fewer curves. There are twice as many free-floating dots as in the last one.

One thing to remember is that each previous level is really just a subset of this next level.

Perhaps even more interesting than ends is the possibility of branching. We can assume that there are no curves and try to construct a maze grammar.

This would not have crossings, per se, rather it would be more square, with cross, the four t's, horizontal and vertical paths, with ends as well, but not really circular or curved. It occurs to me to try this case.

Here is the new basis, that operates only horizontally and vertically, and contains branching. I don't think it could generate a maze, though. On the average, it will probably generate circuits (closed loops).

This grammar is very foursquare. I have rounded off the edges to make it a little more presentable.

Here is the result of generating a random placement from this basis set.

It is a very busy pattern with very few dots. It does tend to be a little maze-like, and the pieces in it are heavily connected.

The tiling grammars I have presented here are reminiscent of Wang tilings.

Perhaps they are even closer to Thue-Morse tilings.

All of these are related to the work I did back in 1993, when the image hose was just invented and I realized that it might bear on this class of tiling grammars.

6 comments:

  1. Hi, I just got to your blog from John Derry's blog and I have to tell you, I love your blog! I have been an enthusiastic user of painter since ver 3. I love that program! I am totally intrigued by your posts on how different things were developed and what sparked the different concepts.
    There was something that has been puzzling me since the first time I used it, and that was the weave tool/option. I wondered what the use was for such a tool, and I had a hard time using it myself, since I know nothing about weaving and understanding the concept and method was always too complicated for me.
    Now that I see your fascination with patterns and repeating elements, like in the tiled mosaic floors in Venice and Ravenna, I understand its presence in painter a lot better!
    But still, do people actually use it? To create weaves?
    One use I would see with it would be to create a weave and then make it into a brush so it can be brushed over surfaces and create the weave as it goes, following the shape it's on, like folds of a cloth. But just flat, it's like a textile design comp, what else can you do with it?
    Anyhow, I just wanted to give you a huge thank you for creating the best program in the world, even better than photoshop.
    Daniela

    ReplyDelete
  2. Thank you, Daniela! It's not a huge surprise to me that you would wonder about the weaving capability in Painter. I'm not sure, but I think I developed it as a material in Painter 3, along with Patterns. It comes from very early work I did before Painter. I actually developed a whole language for representing warp and weft sequences. I attempted to match the weaving designs I could find in the literature, and I actually used it to design real weavings on an 8-harness loom I owned. Weaving is quite a time-consuming hobby, and I lost touch with it (right around the time I lost touch with my Danish wife Ruth). I will include specs for the weaving pattern language in a future post (perhaps Patterns, Part 3).

    The main thing about weavings is that it is pretty arcane. So I'm not sure many people have braved it.

    You are correct in noticing that it really only has a few shadings possible and so it can't really generate a realistic weaving. I may write a program to do that sometime.

    I have been having fun with a pattern program I wrote to make Patterns, Part 2. I am hoping to add some knowledge of color, a la Wang tiles.

    Using a brush to apply a material was a classic desire in Painter. It would be akin to setting the clone source to a pattern or a weave. I'm pretty sure you can for a pattern, but not likely for a weave.

    It would be nice to be able to create 3D depictions of folded fabric, like Vermeer and others in that school. Good idea!

    --Mark

    ReplyDelete
  3. Hi Mark, thanks for your reply. Yes, the love of weaving was evident in the program!
    I'll be interested in reading your post on it.
    As far as painting a brush on a 3d surface, and possible a texture or a weave... as I recall, there was a program a long time ago, I forgot the name but I think it was fractal design, that was like a version of painter that did that, paint on 3d surfaces.
    It was neat, but having no 3d abilities at the time, I could hardly use it. But I remember seeing the great potential, if I could only grasp it...
    Now I still have no 3d abilities, but there are so many more options available for 3d with may ready made things, that a program like that would be very neat, and I could probably use it..... I still have the program, the disc, I mean, but it won't run on Win 7....
    Cloning a texture on a surface would still not follow the contours of a shape... Yes, 3d depictions of a folded fabric is more like what I mean. I am more of the school of DaVinci and Michelangelo, but yes, that is the idea. I guess we still have to use our artistic skills and do it by hand, waiting for Painter to develop that ability!
    Thanks again for very interesting posts! I would have never imagined one day to talk to one of the creators of Painter, actually I would have never thought of a creator behind Painter... What an amazing mix of art and technology!
    Daniela

    ReplyDelete
  4. Yes, the program you are referring to was called Detailer, and I wrote it myself. It could import geometries from 3DS MAX and it could also read Wavefront OBJ format, I believe.

    Painting on a surface to follow the actual lines on the fabric is actually best done when designing the texture coordinates for the model of the fabric itself. And then you just associate a weave texture.

    There are programs that can model the folds of fabric and keep the fabric integrity correct so that the mapping will work properly, and stick to the fabric as it animates.

    So it is actually better not to paint the weaving, just to "map" it onto the surface in the proper (u,v) texture coordinates.

    When painting fabric folds, I like to work from a picture. With "The Miracle of the Paint Can" that appeared on the Painter 4 poster, I shot each of the figures wearing a t-shirt or a long-sleeve shirt. And then I used the folds of that fabric as a starting point to extrapolate and fill-in the fabric folds of the garments that the figures were wearing.

    I should probably write a post on that.

    Thanks!

    --Mark

    ReplyDelete
  5. Yes, Detailer! That was it! You wrote it? wow, I should have known. How come it didn't continue growing like Painter?

    You pretty much lost me on the details of mapping the pattern on the fabric model..... Sorry! :) I did mention that 3d is quite a foreign language to me, right?

    But to render clothes with folds and creases, I tend to do the same, take lots of reference pictures and paint from them.
    But I have this dream that one day programs like Poser will be able to generate images of figures with realistic clothes that can have textures on them like actual fabric and yes, weaves, and realistic folds. And those fabrics will be created in Painter, or painted on in Painter... One can dream, no?
    Often I see 3d figures with clothes that resemble more butter churners than actual clothes...
    But I am changing the subject of this conversation... sorry.
    A post on this would be great!
    Thanks,
    Daniela

    ReplyDelete
    Replies
    1. It is title known, and I will post on this, that Detailer was based on a never-released version of Painter called Painter X3. Right around the time that the PowerPC became a reality and suddenly floating point math got a LOT faster, I started working on some 3D work mixed with Painter. Really it was astounding to paint on a 3D object in real time on a Mac!

      Apple caught wind of it and I went around with some evangelists showing it to interested parties in Japan and Europe.

      Painter schedules intervened and I had to get back to the 2D world, of course. But later on, this product surfaced as Detailer.

      It had a cool box, too.

      Like I said, I will do a post on this product.

      Poser has been a real interest of mine since we hired Larry Weinberg and took the product on at Fractal Design. But eventually Painter and Poser went their separate ways. Larry and I still do exchange comments from time to time on Facebook.

      --Mark

      Delete