158 comments

[ 3.1 ms ] story [ 173 ms ] thread
I'm speechless with admiration.
This is simply magic, I'm kinda speechless.
Tearing at the cloth is just so... satisfying.
I tried so hard to tear that last line, but just couldn't.

Awesome simulation by the way. Just getting into js myself (yeah, I know).

(comment deleted)
Cut, cut and cut across...and it smiles at you. :)
Holy flying batsh*t, that's great!
Is there any connection between this and http://subprotocol.com/verlet-js/ which was posted on HN a few days ago, or did you both happen to play with the same algorithm at the same time?
I'm actually not the developer. I just happened across it, enjoyed it a lot, and was surprised to find that it wasn't posted on HN yet.
Pretty cool, I like how the result of the torn cloth is rather artist looking.

I used to study fine art, if you want to reference something original I always thought setting up a physics engine for creating scenes that you could reference in your painting would be cool, instead of having to acquire and damage the objects yourself.

Read that as "terrible cloth simulation."
This is awesome. I don't know what's more satisfying: actually tearing the cloth to pieces, or the fact that my 2009 13" macbook pro can run it smoothly without stressing the CPU.
Lucky you. It maxes out the CPU on an early 2008 (2.4 GHz w/ x3100) MacBook. I guess an actual GPU makes all the difference.
My 4 year old netbook's Intel Atom N270 (1.6 GHz, 1 GB RAM, Graphics (integrated)Intel (GMA)GPU model 950) only went up to 58% CPU usage during the tearing.

    Running userland applications:
    FreeBSD 9.x
    Chromium
    2 terminals (urxvtc)
    top
    tshark
    DWM + dmenu
Seems like it was worth the $99.
It seems to be smooth on my Nexus 4, but interactions do not work so I'm not quite sure.
I read this headline and was like "Why on earth would I want to see a terrible simulation?" oy
Can anyone speak to what's going on in these algorithms? I'm interested in the physics/math behind them. For example, how much about partial differential equations do I need to know to understand them?
It's very simple really. It's a grid of point masses with constraints between them (the lines you see) that says to keep the points at a constant distance from each other. Think of the constraints as springs that follow Hooks law[1], only infinitely stiff. You iterate through all the constraints and move the two points of each constraint apart if they are too close, or closer if they are too far apart. You need some basic linear algebra for the distance and direction calculations. It's common to use verlet integration to actually move the points because it's so easy do solve the constraints with it. Add some gravity and it looks very convincing.

To tear the "cloth", all you need to do is to remove those particular constraints from the list.

[1] http://en.wikipedia.org/wiki/Hooke%27s_law

One of the things I love about encountering things like this on HN are comments like these, which are even more informative than the original post. I'd seen the demo in the OP, and thought, "neat". Later on, I read comments that say, "Oh, you just need to ___ the ___ with ___, and use ___'s Law to ____ for the whole grid" --- most of which is completely over my head. In some perspectives this might seem discouraging -- trivializing the difficulty of learning it. However, I find it tremendously invigorating: the idea that it's simple for someone with the right learning and knowledge means that it's something I could do to, if I wanted to spend the time to learn it.

Thanks for posting comments like this. It opens my eyes to questions I didn't even know I had. ("What's a verlet?" "Oh man, I need to re-learn my linear algebra someday...")

You can achieve most of this with Euler integration to update the positions and velocities of the points—as well as Hooke's law to simulate the connections as a grid of tiny little springs.

I've used similar algorithms in a graph layout library of mine: http://getspringy.com/

You don't need to know much (if anything) about PDEs. If you've taken an undergrad class in classical mechanics, you'll do just fine.

If you're interested specifically in game physics using Verlet integration, http://web.archive.org/web/20100111035201/http://www.tekniku... is a nice reference. Most of the springy-cloth demos use Verlet integration.

Here's a short series on 3D game physics that doesn't rely on a Verlet integration scheme: http://gafferongames.com/game-physics/. The advantage here is you get a more general ODE solver. It's a little bit more tricky to get right, though.

Once you dig a bit deeper into it, you'll find that the hard part is collision detection/response. A nice intro is the two tutorials at http://www.metanetsoftware.com/technique.html. An in-depth reference is Real-Time Collision Detection by Christer Ericson.

A community related to this is http://www.bulletphysics.org/Bullet/phpBB3/.

That... that was beautiful.
Read this as "terrible" the first time and was confused. Nice effect.
Somebody should put this on the App Store with 10 textures for $0.99 and extras if you buy more. It would sell like crazy.
No, it wouldn't. It's engaging for about 2 seconds, and doesn't even begin to compare to the addictiveness of a successful game, even if you lumped a bunch of bogus social stuff on.

I think this is only really novel to technical users looking through a lens of tech, though of course I think it's incredibly novel too. But addictive video games already do very realistic stuff around hair, cloth, and all sorts of things, and your average game player will rip the cloth and move back to Angry Birds.

I agree it's really cool, and I Facebooked this, but a cool animation a game does not make.

i disagree this could make a lot of money off pure satisfaction. better than playing first person shooters and blowing things up
I disagree too, and it seems by the many comments that say how satisfying this is, that others find this fun. Obviously it would need a little more to make it a game, but just like Osmos which is simple physics and a simple concept (absorb smaller things) it can b very satisfying and successful. I think you're over thinking the game buying public. Many games have been little more than a concept like this.
There are lots of very simple toys that are popular on the App Store. (Of course, it's hard to tell which ones will make money ahead of time.)
I've played with an app called Koi Pond for ages. Its just poking fish and feeding them, but it is still engaging. I would play with a textured cloth. I would pay for an app that let me play with a textured cloth.
"It's engaging for about 2 seconds"

In other words, it clearly surpasses the vast majority of games in the app store.

If you were able to try "the vast majority of games in the app store" no wonder you couldn't spend more than 2 seconds on each.
No wireless, less space than a Nomad. Lame.

This is slashdot's review of the iPod. It's a great example of techies completly under judging a new product

Maybe? Hard to tell - doesn't work on my iPhone. Also most apps without a marketing budget seem to be DOA these days unless they get featured by Apple or come from an established dev.
Would love counterexamples from the downvoters.
Even better: select a photo from your library and tear it up. Bonus points for recording it as a video.
Link it to the accelerometer and gyroscope and watch as your photo flaps about as you move your phone. Combined with tearing up your photo I bet it would get a few downloads.
It's a nice demonstration. Well done.