A small native 3D engine called drie now includes a cloth system based on extended position-based dynamics (XPBD). The solver was moved from the CPU to compute shaders: performance was not dramatically better on the GPU, but the change reduces stutter. Its features include deterministic simulation for reproducible scenes, crease preservation so pleats retain their shape, lower-resolution simulation with finer visual detail, aerodynamic drag, sleep states to save computation, and two-way collisions between cloth and other objects. That two-way interaction also applies between separate cloth pieces, making the handkerchief demonstration a test of how layered fabric behaves.
The main limitations are collisions that let cloth pass through itself or objects. With a coarse mesh, points can slip through gaps, causing folds to tangle or sheets to merge; manual tuning and crease preservation reduce the problem, while spatial hashing helps push overlapping cloth apart. Thin features and sharp corners can still cause fabric to rip through, especially when dragged by tethers that move connected points directly. More gradual force transfer makes the material feel too soft, and signed distance fields are being explored as a way to handle corners, but the issue remains. WebGPU demos show handkerchiefs, fabric draped over furniture, and banners struck by fired spheres. The examples are written in C3 and run through sokol’s WebGPU backend; AI coding tools were used extensively in developing the engine and experiments.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.