Playing with gravity


I was curious to see if basic math could achieve something similar to what seen elsewhere: that strange shape of the accretion disk.



Notice how small are those black balls inside the disks. The resulting picture have a much bigger black circle because… the event horizon is working!
(Because how I coded, photons travel steps are shorter when nearer the black hole, like time shrinking, so reaching the exact center would take infinite time. I made a finite small black sphere to solve that…)

Cool to see the “gravitational lens” at work.
blackholes4


A fixed perceived time interval divide one layer from the next:


50 Likes

Interstellar

3 Likes

Excellent visualisation!
You’re going to have to show how you did it!

2 Likes

…do I? :sweat_smile:


black hole 2D.gh (8.6 KB)
Here some simple 14 rows of code, where I started.


Simplifying formulas, I just made it so some elements are unitary, like:

  • speed of light, c=1
  • gravity constant, G=1

This leads to having the Schwarzschild radius (or event horizon) of a black hole to be equal to its mass!

At each “timestep” the vector of the photon traveling is added with the instant pull of the black hole, and right after that is unitized again (speed of light is constant!).
I can see the shape of the trail do stabilize with small enough steps, but for the screenshot above I did not care about that and used larger steps to have a result in my lifetime XD.

Math may be wrong (and probably is), but gives a decent result even though being extremely simple.


private void RunScript(Point3d O, double M, Point3d p, Vector3d v, double t, int n, ref object trail, ref object event_horizont)
  {
    Polyline poly = new Polyline();
    poly.Add(p);
    for(int i = 0;i < n;i++){
      Vector3d a = O - p;
      double DD = a.SquareLength;
      a.Unitize();
      a *= M / DD;
      v += a * t;
      v.Unitize();
      p += v * t;
      poly.Add(p);
    }
    trail = poly;
    event_horizont = new Circle(O, M);
  }
3 Likes

Why all those tv Nature documentary, BBC science earth and space, official NASA journal, IEEE articles, google scholar patents cant explain that Hole as simple as you did? :wink:

2 Likes

I’m speechless. What can’t Rhino do :exploding_head: :rofl: :sob: :smiling_face_with_tear:

2 Likes

This is honestly mesmerizing, great job Riccardo !

2 Likes

Hi,
Wonderful work. It’s unfortunate Rhino has only convoluted ways to take your hard work to a nicer fuller render solution maybe planes with alpha clouds.

Blender has done a nice job of this.

Create Realistic Black Holes in Blender | Full Tutorial - YouTube

RM

3 Likes

So, if I understand correctly, you’re doing a ‘reverse’ ray-trace from the View Square and getting the colour of the hit object (if any) and putting that as the ray’s start position on the View Square.
You’ll have to forgive me, I’m only in the shallow end of Grasshopper!
Please may we see the whole script?

2 Likes

Exactly. Just like that.
To make things lighter, I’ve generated the big lists (point, vector, colors, and eventually trail polylines) all inside the c# script, because inputting or outputting big lists would slow down whole GH.
So input is the simple “view square” rectangle, and output is a colored mesh (a single object).

I’d like to treasure a bit more what I’ve spent my time over it (like any other under the gallery tag), specifically when it’s something a bit remotely original , given my limited design skills :sweat_smile:. I hope you can understand.
I’ve attached a simple example above, start from there and try. You can pm me with your results.


Rhino ways is your way. A really vaste and complete engine accessible by many roads. In this case it’s GH + rhinocommon via c#.

That solution is tweaking a normal render engine and exploiting refraction index with multiple shells of “glass-like” material.
While the result is really good looking, I’d say it’s objectively wrong: the image of the disk in front of the black hole (nearer the camera/viewer) isn’t deformed at all by the gravity, but it should!
My goal was to “check” if my basic knowledge (a particle system with fixed particle speed) would resemble what seen elsewhere. I know from start I could not achieve a complex render, with lights, materials, shadows, etc
But, for example, I hoped to have similar but simpler effect like:
https://www.iflscience.com/first-image-predicted-supernova-32755 … here the same galaxy is visible trice thanks to gravitational lenses. (And each of the three images have a different “timestamp”… where they could predict a nova burst!).
… and here:


I could see the same black hole 4 times! (and almost 2 more times behind the other disks…) but due to resolution the attached shot only 2 are visible.
Not having any background “sky” leave few object to be seen… I should play it more and enhance the definition.
I’m not sure with multiple shells of glass this effect would occur. Surely a lot different. Light that doesn’t intersect any glass shell will just go perfectly straight.
I was not pursuing aesthetic results as the video you linked. I just wanted to play with math :rofl:
But I’m sure any programmer could get my same result (and better) in any different software. I use Rhino because it’s easy and very accessible.

3 Likes

Finally, this forum delivers! Or rather @maje90 delivers! Nice work… it’s beyond me!

https://discourse.mcneel.com/t/nasa-black-hole-in-gh/93801

7 Likes

This is what NASA thinks it would look like to fly into a black hole

2 Likes

Very, very interesting!
Makes me want to try do the same and see if the result is similar.

Anyway… if the observer/camera of that video is “orbiting” even a little, it should mean it is traveling/falling at relativistic speeds.
Any visible light should blueshift out of visible spectrum, but then the infrared should also become visible…

2 Likes

This video reminded me of your animations above and also made me wonder if you would get the same result!

1 Like

Fantastic!

1 Like