Cloth Simulation with XBPD

(ricar.do)

60 points | by ricardobeat 3 days ago ago

19 comments

  • enjoyyourlife 4 hours ago

    If you don't have WebGPU enabled, https://claude.ai/artifact/YV3wTiemkwoKcBthirFp33 has a cloth simulator that works without it

    • ricardobeat 3 hours ago

      The stack I'm using is targeting WebGPU only unfortunately, as the engine is built for native, web is just one of the outputs.

      The model is quite different though - XPBD is physically based and independent of frame rate (great for VRR), you get control over stretchiness and bends, and adding steps only improves accuracy without changing behaviour. It also lets you deal with constraints more naturally, that's what enables the self-collision for example.

      • erwincoumans 3 hours ago

        Runs great on iphone, thanks for sharing!

  • mandeepj 3 hours ago

    These days a lot of startups are using vision models for quick try-on clothes and seeing products in your home. These are funded by YC. I will add links later. Not saying they are better than cloth simulation.

    I had a startup in the this space. For some reason, virtual tryrooms never caught on with people.

    • goodmythical an hour ago

      I assume they've gotten better than they were when they first started appearing on sites, but I think the quality is the issue for adoption.

      Like, even something "as simple" as glasses (just a rigid polygon, allows camera very close to target, simpler targetting), the results were never more than a sort of goofy circus experience. Glasses that I know would look nice in real lighting on my actual face looked like silly cheap plastic dollar store toys, and so what's the use?

      The few clothing ones I tried had similar problems. The simulated lighting never matches the real world, so it makes me look like I'm wearing a bad video game skin rather than actually trying on a piece of clothing, and so I am left with no more information as to how this product will look on me.

      It always left me with a distinct impression that they were getting more out of this than I was.

  • pixelpoet 8 hours ago

    Typo in the headline, PBD stands for Position Based Dynamics.

    • ricardobeat 3 hours ago

      Ah, good catch! I probably mistyped it, the blog post is correct. Couldn't edit the submission though.

      • pixelpoet 3 hours ago

        As it is the title perfectly describes my last relationship.

    • whizzter 7 hours ago

      The article literally links a paper on XPBD, apparently some kind of extension of PBD with better behaviours (unless the headline has changed?).

      https://matthias-research.github.io/pages/publications/XPBD....

      • pixelpoet 5 hours ago

        I'm quite familiar with it, and contributed to the implementation in Cinema4D; what I meant is that the HN title says "XBPD" not "XPBD". (I seem to have something like the opposite of dyslexia so the whole internet is just one giant mess of typos.)

        PS. Mad respect for being in TPOLM!

        • whizzter 3 hours ago

          Ah right! Takes a while to see it even in this reply when you've typed it out, I guess the fonts we use don't help (though the capped letters probably rarely appear together even in acronyms).

          Also thanks, though I feel like I've mostly been a minor party (though there was some stuff that never got released back in the day).

  • portroyal 7 hours ago

    FYI: this article drops a hotlink[1] which leads to pinball[2]; it's fun.

    1: https://simonbw.com/pinball-performance-2/

    2: https://pinball.simonbw.com/

    • inexcf 5 hours ago

      This runs at like 10x speed for me on Chrome and Firefox, weird.

  • bitbonsai 8 hours ago

    The Handkerchiefs demo is pretty sweet. How could you do that light/flare through the windows?

    Nice demos, indeed.

    • ricardobeat 2 hours ago

      Thank you :)

      The light uses a froxel volumetric fog [1] implementation. The flares are bloom + a rendering from the camera POV, the lens reflection reprojected a few times.

      [1] https://www.mattiasstrand.com/posts/volumetric-fog/

    • whizzter 8 hours ago

      If it's shadowmap based lighting you can trace through it.

      Imagine a ray from the camera to the background pixel, sample the shadowmap along the way if the sample points along the camera ray lies within the shadowmap and add light if the shadowmap depth is further away (simplified, depending on number of lights,etc there's a number of possible optimizations but that should be googleable).

    • worried_individ 7 hours ago

      light through the window looks like standard volumetric rendering, a custom lens flare effect, and some (not sure if physically accurate) blooming of image values beyond the dynamic range in this scene.

  • zokier 5 hours ago

    In the handkerchief demo video the cloth pieces seem to bounce off the ground which looks really odd

    • ricardobeat 2 hours ago

      The goal was to make it behave like linen, but it does look a little rubbery. It's also reduced precision for the web version. Still some fine-tuning to do, thanks for checking it out!