G.R.I.D
- 2 Devlogs
- 7 Total hours
General Relativity Interactive Demonstrator.
General Relativity Interactive Demonstrator.
Most of this session went into one bug, and it’s a genuinely annoying one to reason about, which is why it ate the time.
Added the second mass early on, that part was quick, just refactored mass into a masses array and summed each one’s pull vector. Linear superposition, same as before.
Problem showed up the second I dragged the two masses toward each other. The mesh was folding, points crossing lines they shouldn’t. My first assumption was the per-mass clamp had a bug, so I spent a while re-checking schwarzschildPull in isolation, it was fine, each mass on its own respects its horizon exactly like build 2.
Took embarrassingly long to actually accept that the bug wasn’t in either clamp, it was in the fact there wasn’t a clamp on the SUM. Each mass says “don’t let this point cross my horizon” independently, but if both are pulling the same point in roughly the same direction, the two allowed pulls can add up to more than either alone would permit. Obvious in hindsight.
Tried a couple of wrong fixes before the right one. First attempt was averaging the two pulls instead of summing, which just made single-mass behaviour weaker for no reason and didn’t even fix the overlap case properly. Also considered some kind of smooth blend between the two wells (metaball-style), which would’ve looked nicer but is a much bigger rabbit hole than 5 hours allows, parked that idea for later.
What actually worked was tracking the tightest safe margin (distance to nearest horizon) across all masses while summing, then if the combined pull vector exceeds that margin, scale the whole vector down before applying it. So the constraint moved from “per mass” to “per point, against whichever horizon is closest.” One extra variable, safeMargin, and a scale-down at the end. The fix itself is maybe four lines, finding the actual shape of the problem was the other 4+ hours.
Worth saying clearly, this doesn’t make two overlapping wells physically correct. Real GR still doesn’t superpose like this. What it does is stop the visualisation showing impossible geometry, the mesh degrades gracefully at the boundary instead of folding through itself.
Hopefully the next session is calmer than ts bro it took way too long
Third simulator in the lineup, and this one’s a spacetime mesh, so instead of watching an object move through space you’re watching space bend around it.
Next up: strength slider and a reset button, then a second mass to see how two wells interact with each other.