Trying to improve my multigrid algorithm for calculating the potential field. I am using two grids, the fine one and the coarse one which is 20 times as wide. First I do 20 fine iterations, then 60 coarse ones, then I interpolate to the fine grid and do another 20 there.
I use the jacobi iteration step which is to take the average of the 4 adjacent grid values and add the value of the source of the point times the step size.
This means the source term matters a lot for the coarse iteration. This is a problem because depending on the location of the particle there is one or up to four coarse grid vertices within its radius. This makes a huge difference on their effect. (spot the tiny yellow dots: they are the same mass&radius as the others).

I want to do many coarse steps to get some reach fast.
Alternating between coarse&fine steps is not good because the portals make the interpolation rather expensive.

Maybe I need to distribute my mass more naturally within the radius: more dense in the center, less so in the periphery...

#creativecoding #physics #multigrid #physicssim

Last updated 1 year ago

The difficult part about using multigrid technique with portals present is interpolating the values of the coarse grid back to the fine grid.
In my simple 2grid v-cycle I just avoided the problem by just allowing portals on the middle linea between the coarse vertices. So passsing a portal doesn't change the grid. But if I want multiscale grids that is a harsh limitation.

One idea is to first spread out the coarse grid values voronoi-style and then do some smoothing interpolation.

Other ideas? Calculation-cheap ideas?

#physicssimulation #creativecoding #portals #multigrid

Last updated 1 year ago

Can you spot the portal?

Okay, I think I'm gonna refactor everything again, just one Potential field for all particles, but rendered with a a bit more elaborate multigrid technique...

#creativecoder #multigrid #gravity #physics #portal

Last updated 1 year ago

I implemented a simple v-cycle to numerically sole the gauss-equation for the gravitational Potential. this improves the render speed significantly.
Now I want to add portals to the mix. ^^

#multigrid #gravity #physics #creativecoding

Last updated 1 year ago