Simple 2D black hole simulator

Fizyk

Member
Joined
Jun 20, 2008
Messages
285
Reaction score
1
Points
18
Location
Warsaw
Website
ebvalaim.net
Linguofreak said:
You can't really accurately do Doppler with an RGB image. You'd need actual spectral data.
Yeah, I know. There are better and worse approximations, though ;) I think I have an idea for a better approximation than the one I'm using now, but it can turn out to be impossible to implement in a reasonable way (it depends on whether some integrals can be calculated analytically or not).

Linguofreak said:
I would like more situational awareness info, though. Only knowing my distance from the black hole and what info I can gain visually makes navigation rather difficult, especially in terms of setting up any kind of orbit. It would be nice to have a velocity mangitude indication, plus HUD markers for the velocity vector, the point opposite the velocity vector, and the circle of points at 90 degrees to the velocity vector, as well as the true direction to the black hole (necessary because the aberration of light skews the observed direction to the hole if you have any significant tangential velocity), and the points at 90 and 180 degrees to it.
Yeah, I'm planning to add some more information. The main problem is what information will make sense and how to get it :p For example, I'm not sure if representing the velocity vector of the ship in the ship's frame of reference makes sense and what actually is the "true" direction to the black hole. I think this can be done though.

Linguofreak said:
What would be really sweet, but maybe a bit more work, would be to include an effective potential graph like in the right panel of the applet here. That would make it really easy to judge your orbital situation (whether you are bound for the singularity, in a stable orbit (and if so, how close to circular), or on an escape trajectory).
I was thinking of adding some kind of an orbit MFD, but since the orbit shapes can be really crazy, I didn't have any idea about how to do it. This might be a nice way, thanks for the suggestion :)

Linguofreak said:
Also, it would be nice to have the rotational controls be independent of time warp and pausing. As it is, it can be hard to get a good look around as you cross the event horizon, as everything happens so fast.
Yeah, I thought of it too. I didn't want to do it at first, because the rotation is supposed to be the rotation of the ship, but since it's not very realistic anyway (changes in angular velocity are instantaneous), I'll change it.

On a side note, a quite interesting thing is that in a way acceleration and angular velocity are the same. In fact, I'm using one method to simulate them both. I'm still not sure how to interpret this.
 

Izack

Non sequitur
Addon Developer
Joined
Feb 4, 2010
Messages
6,665
Reaction score
13
Points
113
Location
The Wilderness, N.B.
I see what you mean about interesting effects far from the black hole. Thrusting directly toward it briefly flings the user out the other end at ludicrous velocity if time warp isn't close to zero:
BHS0.png


I have some odd graphical artefacts not present on your screenshot:
BHS1.png


Presumably a result of graphics card differences. The white areas become pink inside the photon sphere.
 

Fizyk

Member
Joined
Jun 20, 2008
Messages
285
Reaction score
1
Points
18
Location
Warsaw
Website
ebvalaim.net
Izack said:
Thrusting directly toward it briefly flings the user out the other end at ludicrous velocity if time warp isn't close to zero:
Yup, that's what I was talking about. The time step was too big and it tried to make you go through the singularity. There is a "safety stop" in the program for such situations, but unfortunately it doesn't work in most cases :p I'll have to come up with something better.

Izack said:
I have some odd graphical artefacts not present on your screenshot:
Now this is strange. It's like those pixels weren't processed at all, because after processing they have no chance of being anything other than black. I have no idea why that happens.

Izack said:
The white areas become pink inside the photon sphere.
Hmm, that's pretty strange, too. White is supposed to represent UV, so unless you are braking hard, it shouldn't turn back into purple/pink. Strange things can happen near the singularity as there are problems with numerical precision there, but colors shouldn't change at the photon sphere.
 

Linguofreak

Well-known member
Joined
May 10, 2008
Messages
5,034
Reaction score
1,273
Points
188
Location
Dallas, TX
Yeah, I'm planning to add some more information. The main problem is what information will make sense and how to get it :p For example, I'm not sure if representing the velocity vector of the ship in the ship's frame of reference makes sense and what actually is the "true" direction to the black hole. I think this can be done though.

Mostly I'm worried about "what direction do I need to thrust to increase/decrease my velocity", "what direction do I need to thrust to change direction without changing velocity (aside from the effects of gravity)", "what direction do I need to thrust to change my vertical/horizontal velocity without affecting my horizontal/vertical velocity", and other such questions.

On a side note, a quite interesting thing is that in a way acceleration and angular velocity are the same. In fact, I'm using one method to simulate them both. I'm still not sure how to interpret this.

Well, acceleration is basically the curvature of your world line in relativity.

---------- Post added at 13:07 ---------- Previous post was at 13:06 ----------

I have some odd graphical artefacts not present on your screenshot:
BHS1.png

I get that around the edge, but not in the middle.
 

Fizyk

Member
Joined
Jun 20, 2008
Messages
285
Reaction score
1
Points
18
Location
Warsaw
Website
ebvalaim.net
Linguofreak said:
Mostly I'm worried about "what direction do I need to thrust to increase/decrease my velocity", "what direction do I need to thrust to change direction without changing velocity (aside from the effects of gravity)", "what direction do I need to thrust to change my vertical/horizontal velocity without affecting my horizontal/vertical velocity", and other such questions.
I see. It should be doable easily enough.

Linguofreak said:
Well, acceleration is basically the curvature of your world line in relativity.
Yes, but you can also look at it as something that tells you how much you have to deviate from parallel transport when transporting the four-velocity along the world line. On the other hand, angular velocity is something that tells you how much you have to deviate from parallel transport when transporting other 3 four-vectors (up, forward, right) along the world line and in this sense it is very similar to acceleration.

Linguofreak said:
I get that around the edge, but not in the middle.
The white pixels around the edge aren't artifacts, but just points in which deflected rays randomly hit some stars in the background. Since deflections are very large near the edge, neighboring pixels get translated to very different pixels on the background and those white points look isolated.
 

Fizyk

Member
Joined
Jun 20, 2008
Messages
285
Reaction score
1
Points
18
Location
Warsaw
Website
ebvalaim.net
I uploaded a new version, which displays velocity and Orbiter-like markers for velocity vector, "crosshair" and true direction to the black hole (this one is a blue cross, so not really Orbiter-like ;) ). You can now also rotate when paused and the speed of rotation is time-warp-independent. There is also a way to toggle the Doppler effect (P key) and change FoV (Z/X).

Link is the same as before.

EDIT: Meh, didn't get merged with the previous post :p
 
Last edited:

Linguofreak

Well-known member
Joined
May 10, 2008
Messages
5,034
Reaction score
1,273
Points
188
Location
Dallas, TX
I uploaded a new version, which displays velocity and Orbiter-like markers for velocity vector, "crosshair" and true direction to the black hole (this one is a blue cross, so not really Orbiter-like ;) ). You can now also rotate when paused and the speed of rotation is time-warp-independent. There is also a way to toggle the Doppler effect (P key) and change FoV (Z/X).

Link is the same as before.

EDIT: Meh, didn't get merged with the previous post :p

Looks fairly good. I am seeing a slight omnidirecitonal blue shift when toggling Doppler at low speed, though. (Actually, thinking about it, this may not be a bug. I'll have to calculate the escape velocity at our starting point of 15 RS and see what kind of shift that would correspond to).

I don't suppose there's any chance of having an option to use a Kerr instead of Schwarzschild metric? :)

I'm thinking it would probably complicate any kind of effective potential graph to a huge degree, so I'm not holding my breath.
 

Fizyk

Member
Joined
Jun 20, 2008
Messages
285
Reaction score
1
Points
18
Location
Warsaw
Website
ebvalaim.net
Linguofreak said:
Looks fairly good. I am seeing a slight omnidirecitonal blue shift when toggling Doppler at low speed, though. (Actually, thinking about it, this may not be a bug. I'll have to calculate the escape velocity at our starting point of 15 RS and see what kind of shift that would correspond to).
That's supposed to be the gravitational blueshift, so it indeed isn't a bug ;)

Linguofreak said:
I don't suppose there's any chance of having an option to use a Kerr instead of Schwarzschild metric?
I was hoping I would make a Kerr simulator, but it was too slow. For Schwarzschild I could accelerate it about 1000 times by using the spherical symmetry and precalculated deflection angles. In Kerr spacetime the rays don't even have to travel in one plane, so the problem becomes much more complicated and I'd have to do full raytracing, which would make it about 1000 times slower. It might be possible to include more data in the precalculated arrays, but they would probably become really big.

I will think about it when I manage to get rid of the problems with the Schwarzschild simulator (like those ugly artifacts), but it looks rather hopeless. It will probably need to wait for faster computers :p
 

Linguofreak

Well-known member
Joined
May 10, 2008
Messages
5,034
Reaction score
1,273
Points
188
Location
Dallas, TX
That's supposed to be the gravitational blueshift, so it indeed isn't a bug ;)


I was hoping I would make a Kerr simulator, but it was too slow. For Schwarzschild I could accelerate it about 1000 times by using the spherical symmetry and precalculated deflection angles. In Kerr spacetime the rays don't even have to travel in one plane, so the problem becomes much more complicated and I'd have to do full raytracing, which would make it about 1000 times slower. It might be possible to include more data in the precalculated arrays, but they would probably become really big.

How big? Tens of megabytes? Hundreds? Gigabytes?

One idea that strikes me is to only do trajectory calculation and very basic display (light behaving Newtonianly, so to speak) in realtime, and only do relativistic raytracing when the simulator is paused.

I will think about it when I manage to get rid of the problems with the Schwarzschild simulator (like those ugly artifacts), but it looks rather hopeless. It will probably need to wait for faster computers :p

I wasn't really too hopeful in the first place. I had a feeling the math would be quite hairy.
 

Fizyk

Member
Joined
Jun 20, 2008
Messages
285
Reaction score
1
Points
18
Location
Warsaw
Website
ebvalaim.net
Linguofreak said:
How big? Tens of megabytes? Hundreds? Gigabytes?
For reasonable precision, at least hundreds of megabytes. Maybe entering the gigabytes range.

Linguofreak said:
One idea that strikes me is to only do trajectory calculation and very basic display (light behaving Newtonianly, so to speak) in realtime, and only do relativistic raytracing when the simulator is paused.
Doable, but somewhat inconsistent. The point of the simulator is to be able to see what you would see near a black hole, so abandoning this idea isn't really what I want to do ;)

Linguofreak said:
I wasn't really too hopeful in the first place. I had a feeling the math would be quite hairy.
The problem is not really the math, which is quite similar to the Schwarzschild case, but less symmetry (axial instead of spherical).
 
Top