https://twitter.com/jamportz/status/1079777103892135936 https://tinyurl.com/y859v78t
For magnetic fields, the problem is there are no simple (non-trivial) solutions for the magnetic fields of interesting things like a bar magnet. Even the magnetic field of a circular loop of current involves elliptic integrals. (see e.g. https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/200100...).
What you could do is numerically solve the https://en.wikipedia.org/wiki/Biot%E2%80%93Savart_law (given your currents) inside the GLSL shader.. Though this will probably be very slow..
https://quickfield.com/index.htm
I also recall there being at one time a DOS-based magnetic field simulation software, but I can't recall the name of it. Probably could find it (or at least the shareware version) in a simtel archive somewhere.
If you really want a better answer for this, look into browsing and asking around one of the various "magnetic overunity" perpetual motion/energy sites out there. Tons of people out there using such software trying to crack the laws of thermodynamics and extract "free energy" from magnets - here's a start down that wormhole:
I've been searching for something like this for years.
Looking at the source code, indeed many of the magnetic fields are computed via the Biot-Savart law, though some interesting ones are not. I might try rendering them.
My personal curiosity only. I love magnets and a have a couple of them.
Do you know any cheap or free tools, that work in the browser/osx/linux and can simulate how magnets interact?
How 2 or 3 magnets interact with each other, how magnetic forces interact etc.
It must not be 100% accurate, just ballpark estimation for fun playtime :)