From what I understand it's not just floating point errors, but due to the nature of approximating continues function as simple discrete steps. Linked wikipedia article has a graph demonstrating that with large steps the error accumulates way before floating point precision is a concern.
There are different numeric integration techniques with different tradeoffs. Stuff like Eulers method, Verlet, Runge-Kutte. In some of them overall energy tends to accumulate in others it gets lost both of which is wrong. Some of the more complex ones tend to behave a bit better, but then you get into the problem whether gains from each individual step being more complex outweighs what you would get from running more iterations of simpler/faster algorithm.
[1] - https://scrawl-v8.rikweb.org.uk/demo/particles-008.html
[1]: https://www.cs.cmu.edu/afs/cs/academic/class/15462-s13/www/l...
It's not only the rounding error, it's also quantisation of time and other minor errors coming from the mathematical model itself.
If the error is on the damping side, you get the real life effect of motion eventually stopping due to energy dissipation. If it's on the acceleration side you get a runaway simulation.
For me, sometimes I wonder since I never did CS undergrad, I will never understand any of this no matter how many programming langauge I learn. I did dabble a bit with OPENLY, LIBGDX, GODOT, unity but to come to with cloth simulation from scratch, damn
If you aren't ready for it in 3d, do it in 2d.
There are a few algorithms like some cloth sims based on particle positions and springs, which can be coded easily, but that was misleading to me when trying to improve, I had to dig a lot more into physics and numerical analysis then mapping the problem to code, which can end up clunky and with a lot of magic numbers.
You didn't specifically ask about game development, but that domain is where the majority of graphics, mathematics, lighting, physics, etc, knowledge is distributed. And it can be difficult to find information solely about (e.g.) cloth simulation and other niche topics without it being coupled into game development resources.
I happened to read https://alextardif.com/LearningGraphics.html today, which might give you some pointers in various directions. https://learnopengl.com/ gets a consistently good rap, even today when there are newer APIs like Vulkan, Metal and DX12. Consider the API as 5% of the problem to solve though (less tbh, though Vulkan is proving even heavier than I was warned).
If you don't want to learn C/C++, I understand there's a large community around WebGL, so finding their subreddits and other forums could be a good starting point too.
However, again, the API and platform is really just a wrapper around the actual physics simulation (the impressive/novel part).
(Source: I'm a web dev/gradle/java developer who is once again building a game engine in their spare time after a previous attempt many years ago)
https://pikuma.com/blog/verlet-integration-2d-cloth-physics-...
rikroots•9h ago
[1] - https://codepen.io/dissimulate/pen/eZxEBO
[2] - https://github.com/Dissimulate/Tearable-Cloth
wingerlang•8h ago
It's very simple to implement a basic setup like this, and I agree that the results are super cool.
ribcage•7h ago