Computers Learn to Knit

Computer Knitted Glove using stitch meshes. All rights remain with their owners. Image sourced from

I always watch for great knitting in the movies.

Not that I see it that frequently.  But sometimes a sweater appears on the silver screen that makes me go “Oooooh!  Now why didn’t I think of that!”  and I completely lose track of the dialogue for a few moments while mentally dissecting the costume department’s decision.

Most, if not all, of these sweaters appear in live action films.  And that has nothing to do with any bias on my part.  Animated sweaters don’t really exist.  And as it turns out, that’s because computers don’t like knitting.

The knitted swatch we can accomplish with yarn and needles in a couple of minutes takes a computer hours to render.  It has to do with the fact that the yarn is just one long string, woven in and out of itself, and that each stitch pulls and hangs on every other stitch.

Knitting flops.  It stretches.  It has an amazing bias.  It bunches up in cables, spreads out in lace stitches, and curls at the edges when the gauge is off.  It is a very dynamic fabric.

Animated fabric so far has consisted of a three-dimensional shape with a two-dimensional texture layered on top of it.  For example, an animator will take a three-dimensional animated character, and dress it in a three-dimensional animated shirt shape.  Then to make the shirt look like a shirt, they ‘paint’ the shirt shape with a fabric print – plaid, stripes, paisley, what have you.

The problem with just painting a knitted texture onto the shirt shape is that it doesn’t move or lay like actual knitted fabric.  As we pointed out earlier, knitted fabrics have depth in between the stitches. The fabric itself can twist around itself and the stitches exert tension on each other.

So animated sweaters would only resemble real sweaters if we all felted our pullovers first, then perhaps starched them so that they could stand on their own two-ply.  Maybe.

The Computer Part –

Animators have recently figured it out though, and in a presentation given in August 2012, explained what it takes to teach a computer to knit.

Here’s the video they posted:

For starters, animators ditch the needles and yarn and substitute a stitch mesh.   A stitch mesh is basically a graph which decides in advance just how the knitting will have to stretch in order to fit any given object.  It doesn’t stretch it, just decides where it will stretch later on.

Then fill the stitch mesh with the stitch pattern.  This is where it starts getting tricky.  Each individual type of stitch–our yo, k2tog, p2tog tbl, m1, and so on–are assigned a shape.  Inside the shape is the intersection of two stitches.  This is how stitch meshes are different from previous methods of computer knitting, by focusing on the intersection of two stitches rather than on one individual stitch.  This means that the shapes automatically connect to each other like puzzle pieces.

After tiling in all the stitches (the software makes good use of how knit patterns repeat to copy and paste them in), animated yarn is added.  This transforms the flat stitch shapes into something knitters will recognize as knitting.

We don’t stop there though, because this knitting is still frozen.  The stitches are too perfect.  There’s no gravity.  No tension on the stitches. None of that knitted floppiness I’ve come to know and love.

So the whole thing goes through a process called relaxation which makes the computer knitting look like actual knitting.

As the video shows, the whole thing is slightly more complicated than what I’ve described, but that’s basically it.  The cool part is the change in how computers handle knitting – from actually animating knitting with one long string to dividing it into a bunch of little shapes, each the intersection between stitches, and tiling it together to make knitted fabric.

The obvious implication is that animating knit sweaters is now more feasible than before.  What I’d like to see happen is the technology evolve into something available to designers.  There’s software for creating lace and cable charts for patterns, but wouldn’t it be amazing to leave the graph paper behind entirely and finish a design on the computer with a three-dimensional diagram of what you’d like to knit? When something hangs a little differently than what I might like, it would be nice to find out via computer short cut rather than spending hours ripping and re-stitching a finished garment.

Reference Links – In No Particular Order

 Happy Knitting!


Put Your Two Cents In Here:

%d bloggers like this: