Show HN: Physically accurate black hole simulation using your iPhone camera

4 days ago (apps.apple.com)

Hello! We are Dr. Roman Berens, Prof. Alex Lupsasca, and Trevor Gravely (PhD Candidate) and we are physicists working at Vanderbilt University. We are excited to share Black Hole Vision: https://apps.apple.com/us/app/black-hole-vision/id6737292448.

Black Hole Vision simulates the gravitational lensing effects of a black hole and applies these effects to the video feeds from an iPhone's cameras. The application implements the lensing equations derived from general relativity (see https://arxiv.org/abs/1910.12881 if you are interested in the details) to create a physically accurate effect.

The app can either put a black hole in front of the main camera to show your environment as lensed by a black hole, or it can be used in "selfie" mode with the black hole in front of the front-facing camera to show you a lensed version of yourself.

  • There are several additional options you can select when using the app. The first lensing option you can select is "Static black hole". In this mode, we simulate a non-rotating (Schwarzschild) black hole. There are two submodes that change the simulated field-of-view (FOV): "Realistic FOV" and "Full FOV". The realistic FOV mode takes into account the finite FOV of the iPhone cameras, leading to a multi-lobed dark patch in the center of the screen. This patch includes both the "black hole shadow" (light rays that end up falling into the black hole) and "blind spots" (directions that lie outside the FOV of both the front-and-rear-facing cameras). The full FOV mode acts as if the cameras have an infinite FOV such that they cover all angles. The result is a single, circular black hole shadow at the center of the screen.

    Next, you can select the "Kerr black hole" mode, which adds rotation (spin) to the black hole. Additionally, you can augment the rotational speed of the black hole (its spin, labeled "a" and given as a percentage of the maximal spin).

    • In a nutshell, the app computes a map from texture coordinate to texture coordinate. This map is itself stored as a texture --- to obtain the value of the map on texture coordinates (x,y), one samples the texture at (x,y) and the resulting float4 contains the outputs (x',y') as well as a status code.

      When the user selects the "Static black hole" mode, this texture is computed on the GPU and cached. The "Kerr black hole" textures, however, have been precomputed in Mathematica, due to the need for double precision floating point math, which is not natively available in Apple's Metal shading language.

      The source code, including the Mathematica notebook, can be found here https://github.com/graveltr/BlackHoleVision.

      5 replies →

  • I’m confused by what I see.

    It looks like nothing actually disappears. I expected a black hole to not just affect what an area looked like, but also to “disappear” some part of what was there.

    • I think that’s why this demonstration is interesting. It’s showing how the light can be bent around the black hole. Anything that crosses the event horizon won’t be coming back, but because of the lensing of the light you can “see” behind a black hole.

      5 replies →

    • Because, for an external observer, time infinitely slows down near the event horizon. In other words, during one hour by the clock of the far-away observer, the time that passes by the clock of the falling observer approaches zero as he approaches the event horizon. So, when you look from the outside, objects get 'frozen' as they approach the event horizon. For the falling observer, nothing special happens at the event horizon, and he just falls through.

      If you happen to approach the event horizon closely and come back again far away to where you started, you will see that a lot of time passed at your origin, while by your clock, the trip might have been short.

  • As far as I can tell, the black hole's you're generating don't look especially correct in the preview: they should have a circular shadow like this https://i.imgur.com/zeShgrx.jpeg

    • What the black hole looks like depends on how you define your field of view. And if the black hole is spinning, then you don't expect a circular shadow at all. But in our app, if you pick the "Static black hole" (the non-rotating, Schwarzschild case) and select the "Full FOV" option, then you will see the circular shadow that you expect.

      4 replies →

Neat. I'll probably use it for five minutes, appreciate the math that went into it, and move on. But nevertheless, pretty neat.

I say that because there's an idea to play with for a v1.1 that would give it staying power for me:

Do you have enough processing power on an iPhone to combine this with Augmented Reality? That is to say: can you explore "pinning" a singularity in a fixed region of space so I can essentially walk around it using the phone?

Assuming that's possible, you could continue evolving this into a very modest revenue generating app (like 2 bucks per year, see where it goes?) by allowing for people to pin singularities, neutron stars, etc. around their world and selectively sharing those with others who pass by. I'd have fun seeing someone else's pinned singularity next to the Washington monument, for instance. Or generally being able to play with gravity effects on light via AR.

  • Commenting to reinforce this idea: I'd love an AR approach where I can pin a black hole with a given radius into my living room, and walk around it!

    The geosharing augmented reality thing mentioned by the parent comment is very very cool too, I'd pay a few bucks for that! Maybe make it social by letting black holes that people drop somewhere IRL merge, etc...

    Reach out to me if you eventually would like to spin up a cheap bit of infrastructure to host the data of where people dropped their black holes, and need some help with that!

    • It would be neat to also get stats about the black hole depending on where you are in relation to it (obviously this breaks physics as a micro black hole would immediately fall into the earth). Everything is based on the hawking radiation calculator: https://www.vttoth.com/CMS/physics-notes/311-hawking-radiati...

      Example: Set mass of black hole to 1e12 metric tons, or about 100,000 great pyramids.

      This has a schwarzschild radius of 1485 femtometers (1 femtometer is around size of a proton).

      Nominal luminosity is 356 watts. You could power your computer! Lifetime is 1e12 gigayears.

      An interesting thing comes with gravity. Gravity at the schwarzschild radius for this mass is 3e28 m/s^2, but this is at a smaller-than-an-atom radius.

      If you put your hand within a foot of it, gravity would be 700,000 m/s^2.

      You would need to be at a distance of 270ft to experience gravity from it that compares to earth (9.8 m/s^2).

      3 replies →

  • That's an excellent idea! And indeed, part of the reason we started with the iPhone is because we've been thinking from the get-go about an eventual extension to Apple Vision Pro. As I wrote in my other comment, this is part of an outreach effort to get the public (and students) excited about black hole physics, so we will always keep the code free and open source.

  • You need a full 3D scan of the environment of everything the black hole can "see" from the position you want to put it in, not just the traditional "augmented reality" that sits on top of a current camera feed, because black holes are also essentially 360 degree cameras that from some angle will let you see anything around them. Not impossible, but harder than "just" taking an augmented reality feed.

Very nice – if only I could try it! :'-) Any chance this could be ported to Android, at least for high-end devices with a decent GPU?

  • The rotating black hole version that we implemented requires GPU code, and porting that to Android is nontrivial---though we'd love it if someone took our open-source code and ported it!

    In the meantime, check out this code developed by Dominic Chang (grad student at Harvard) that implements lensing by a non-rotating (Schwarzschild) black hole in your browser: https://dominic-chang.com/bhi-filter/

I recommend using a different preview screenshot on the App Store page. The first (most important) screenshot is without the effect at all. The use of the galaxy image doesn’t really reflect what it’s like to use the app.

Just tried to check it out. First boot it crashed, killed app and tried again and now it won’t open. I’ll try and reinstall and do over. iPhone 16 Pro, iOS 18.1

Quick edit- I did exactly that and now it works fine. First boot up before seemed like it got stuck when asking for permission to use the camera.

  • Glad it worked on second boot! We used to have some bugs in the elliptic integral implementation that led to the app crashing, but we think we've eliminated those, so hopefully this is just a fluke... Anyone else with this issue?

Pendatic but can I ask why does this app require 17.5 or later? For reference, the latest iOs version is 18. What specific API is being used to require that version?

  • Good point, the minimum version should be an earlier version of iOS, we don’t use any APIs that are only available in 17.5 or later.

    Thanks for pointing that out.

This is awesome. I see that this is GPL and open on GitHub. Thank you for sharing. If you are open to feature requests that I am too lazy and stupid to accomplish on my own, I would appreciate the option to drop the multi camera view and the option to capture a photo. Also plus one to the idea of being able to pin the black hold to a specific orientation so you can see what it looks like to pan around an object adjacent to the black hole.

  • Adding options to drop the multi-camera view and to capture a screenshot is relatively straightforward, and I think we can implement that in the next update. Pinning the black hole to a specific place is a whole other undertaking...

    • Thanks for responding. Pining in space requires some tricky 3D math so I get that it is a pain. The multi view thing is also kind of cool since it shows how space distorts. I think I really just wanted to share the warped image so a capture button for the distorted image is really all I need.

Did anybody else first think —before seeing the app images— that it was somehow using the camera of the iPhone to simulate the physics of the black hole?

I wonder if this would be better as a webpage and not an app. It’s something I want to share far and wide for everyone to play with for five minutes. But as an app, most people I send it to won’t go install it.

I’m no astrophysicist but it all looks doable with the camera API, canvas API, and WebGL or WebGPU shaders. That actually sounds like a lot of fun.

Not related to the app, but could someone explain how something with huge though finite mass can create a singularity which is a point of infinite density? Can there also be black holes which are just dark stars with intense gravity having a hard surface?

That seems cool. It would be interested to see a simulation for Kerr-Newman BH. Although I have no idea what would be the best way to see the effects without some sort of perturbation. Not that this is astrophysical BH of course. Just a thought experiment.

  • I haven't looked into the equations but I expect the effect of varying the electric charge would be similar to (but less dramatic than) changing the spin of the black hole, which as you can see in our app is not that big of a change.

Does anyone else find it jarring to unexpectedly be shown the selfie camera view? Showing both camera feed thumbnails constantly while using this app is a little odd.

Still, kinda fun, reminds me of playing around with different blur / liquidify filters in photoshop back in the day.

  • Good point. In a future update, we can add a button to show / hide the camera views.

> Data Not Collected

> The developer does not collect any data from this app.

Well, duuh, nothing can escape the black hole, not even information!

Would a person notice red-shifts from the black hole as well?

  • Yes, but one issue is that the amount of redshift depends on the motion of the emitter, so we would have to artificially assign some four-velocity to your surroundings in order to give them some redshift. There doesn't seem to be a "natural" choice for how to do this.

    TLDR: redshift depends not only on the position of the source, but also its velocity.

    • Since you don't notice any red-shift with your eyes in daily life, why is zero velocity relative to the camera not a natural choice? Or maybe I'm not following you?

      2 replies →

As always, wonder what a particular "free" thing is selling and to whom. In this case it's something called BHEX, to NASA.

  • As Project Scientist for BHEX, I am of course excited about the project and eager to spread the word about it! But as I wrote in my other comment, what this is really trying to "sell" is gravitational physics to students interested in black holes, and this effort is supported in part by the National Science Foundation.

Is in the middle of black hole zero gravity? Then, is there another event horizon somewhere inside black hole?

  • I don’t think anybody really knows what‘s inside a black hole. That’s kind of their defining property.

  • Well technically it approaches infinite gravity. It's a gravitational asymptote. But like the other commenter said, no way to know what it actually is in reality, as we only have mathematical concepts that may or may not match reality.

Does it use iPhone-specific features or could it work on, e.g., a desktop

  • We wanted the app to work on an iPhone and that required the use of Apple Metal code. This could of course be ported to a desktop but we're not sure there would be much interest in that?

    • Maybe WebGPU would be a good porting target.

      Really cool app btw!

      I have once seen a video of Kip Thorne, explaining that the black hole visual effects of Interstellar were an actual physical simulation. I wouldn't have thought, that it was feasible to run on an iPhone.

      2 replies →

What happens with the rotating one and a realistic POV?

  • It looks needlessly complicated and messy because the visually interesting region when rotation is turned on is blocked out by the FOV cutouts. We felt it was best to only allow the user to select the full FOV in this mode.

    Thanks for the question!

No plans for an Android version?

  • Not currently. As I mentioned elsewhere, the rotating black hole version that we implemented requires GPU code, and porting that to Android is nontrivial---though we'd love it if someone took our open-source code and ported it!

    In the meantime, check out this code developed by Dominic Chang (grad student at Harvard) that implements lensing by a non-rotating (Schwarzschild) black hole in your browser: https://dominic-chang.com/bhi-filter/

Another nice feature would be if it could simulate an accretion disk.

  • That would be cool, but then you wouldn't be seeing the world around you anymore. In other words, at that point it becomes a GRMHD simulation, and there is no point in using cameras since the user's environment is obscured, no? Or did you have something else in mind?

This is not a simulation of a black hole, but rather an image filter that emulates one particular effect.

  • Yes, agreed. We thought it would be fair to call it a "simulation" of what your surroundings would look like if a black hole were within your FOV, but as you say we do not take into account all effects (time delays in particular would require a lot of buffering and we decided this would be impractical to implement, and not that illuminating).

    • This is still nice when there are so many artistic images of black holes that do not take such care to use known physics to create an accurate image. Well done all. Looking forward to seeing what BHEX sees.

      4 replies →

    • You're right that the time delays and redshifting wouldn't add much to a toy app, but some of us are here for the physics.

      Honestly it's not so far-fetched (to me) that in a few years someone will have GRRMHD simulations running in real time on a portable device.

      Are you familiar with A Slower Speed of Light? It's a game which has some nice special-relativistic effects.

      http://gamelab.mit.edu/games/a-slower-speed-of-light/

      6 replies →