[HN Gopher] Show HN: Physically accurate black hole simulation u...
       ___________________________________________________________________
        
       Show HN: Physically accurate black hole simulation using your
       iPhone camera
        
       Author : yunyu
       Score  : 193 points
       Date   : 2024-11-19 17:06 UTC (5 hours ago)
        
 (HTM) web link (apps.apple.com)
 (TXT) w3m dump (apps.apple.com)
        
       | lupsasca wrote:
       | 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.
        
         | lupsasca wrote:
         | 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).
        
           | lupsasca wrote:
           | 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.
        
             | lupsasca wrote:
             | We hope you enjoy watching the world with Black Hole Vision
             | and welcome any questions or feedback. If you like the app,
             | please share it with your friends!
             | 
             | The code was written at Vanderbilt University by Trevor
             | Gravely with input from Dr. Roman Berens and Prof. Alex
             | Lupsasca. This project was supported by CAREER award
             | PHY-2340457 and grant AST-2307888 from the National Science
             | Foundation.
             | 
             | License: This app includes a port of the GNU Scientific
             | Library's (GSL) implementation of Jacobi elliptic functions
             | and the elliptic integrals to Metal. It is licensed under
             | the GNU General Public License v3.0 (GPL-3.0). You can view
             | the full license and obtain a copy of the source code at:
             | https://github.com/graveltr/BlackHoleVision.
        
               | timthorn wrote:
               | By any chance, was Andrew Strominger involved in this at
               | all? He gave the Andrew Chamblin Memorial Lecture in
               | Cambridge last month and demoed something that looked
               | similar.
        
               | lupsasca wrote:
               | Yes, Andy has been very involved in the story of the
               | photon ring and was one of the lead authors on the
               | original paper that started it all:
               | https://www.science.org/doi/10.1126/sciadv.aaz1310
               | 
               | (And he was also my PhD advisor.)
        
               | lupsasca wrote:
               | I think what he showed you was likely a version of this
               | that was coded up by Harvard graduate student Dominic
               | Chang: https://dominic-chang.com/bhi-filter/
               | 
               | It works very well (and in a browser!) but is limited to
               | a non-rotating (Schwarzschild) black hole---we really
               | wanted to include black hole spin (the Kerr case). As we
               | write on the github, talking with Dominic about his
               | implementation was very useful and we are hoping to get a
               | paper explaining both codes out before the end of the
               | year.
        
         | jtbayly wrote:
         | 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.
        
           | useless_foghorn wrote:
           | 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.
        
             | jtbayly wrote:
             | So if I'm understanding correctly, the black hole is
             | supposed to be between me and what I'm looking at, not _in_
             | what I'm looking at?
             | 
             | If so, then my question is wouldn't _some_ light be lost to
             | the black hole? Shouldn't a substantial portion of the
             | light coming at me from the other side of the black hole
             | disappear into the black hole, making what does lens around
             | dimmer?
        
               | bmurphy1976 wrote:
               | Yes some light would be lost the black hole, but also
               | some light you would not have normally seen is now coming
               | your way due to space time warping.
        
               | ayakang31415 wrote:
               | Here's Veritasium video on Gravitational Lensing effect:
               | https://www.youtube.com/watch?v=zUyH3XhpLTo
        
           | cft wrote:
           | 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.
        
         | judge2020 wrote:
         | I feel like this app could also be an app clip to make it so
         | that you don't have to outright install the app to use it:
         | https://developer.apple.com/app-clips/
        
         | 20k wrote:
         | 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
        
       | cybenko wrote:
       | What happens with the rotating one and a realistic POV?
        
         | graveltr wrote:
         | 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!
        
       | lambdadelirium wrote:
       | >physically accurate >event horizon doesn't appear in my room :(
        
         | lupsasca wrote:
         | Something to rejoice about, no? ;)
        
       | bryant wrote:
       | 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.
        
         | lupsasca wrote:
         | 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.
        
         | isoprophlex wrote:
         | 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!
        
           | mjrpes wrote:
           | 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).
        
             | isoprophlex wrote:
             | That is 356 watts of luminosity from something so small?!
             | Whoa! It says the peak of the radiation has an energy of 41
             | keV though, so better not look at it directly (:
             | 
             | I tried plugging in some other numbers and, at first
             | confusingly, found that the luminosity goes up at lower
             | masses?! But of course it radiates from it's outer shell,
             | not the entire volume.
             | 
             | Wonderful tool, imagine playing with those parameters in AR
        
               | lupsasca wrote:
               | Yes, this is one of the wonderful crazy properties of
               | black holes: they get _hotter_ as they evaporate! (More
               | precisely, the Hawking temperature is inversely
               | proportional to the mass!)
        
               | mjrpes wrote:
               | It's crazy how hot and luminous they get. At 45 seconds
               | left in a black hole's life, it has the luminosity of
               | 85,000 megatons of TNT, and only gets exponentially
               | hotter as those 45 seconds count down. In the last
               | fraction of a second of it's life, with one metric ton of
               | mass left, its luminosity is greater than the sun.
        
         | deadbabe wrote:
         | That's exactly what I thought this would be, imagine my
         | disappointment.
        
         | jerf wrote:
         | 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.
        
           | grahamj wrote:
           | It could be done in VR instead, where the entire environment
           | is available.
        
         | dartos wrote:
         | Not everything needs to generate cash :)
        
           | ripped_britches wrote:
           | Generating cash is a proxy for generating long term human
           | value
        
             | tjohns wrote:
             | Not everything needs to generate long term human value.
             | It's okay to just have fun, too.
        
             | syndicatedjelly wrote:
             | What a warped thing to believe in
        
             | robocat wrote:
             | Under what assumptions?
             | 
             | Just trying to guess at what they could be is costing me
             | random time...
        
       | 01HNNWZ0MV43FF wrote:
       | Does it use iPhone-specific features or could it work on, e.g., a
       | desktop
        
         | lupsasca wrote:
         | 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?
        
           | lagrange77 wrote:
           | 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.
        
             | lupsasca wrote:
             | The black hole simulation that was shown in the movie
             | Interstellar is explained in detail in this paper, freely
             | available on the arXiv: https://arxiv.org/abs/1502.03808
             | 
             | As a physicist with a modest background in computing, I was
             | also surprised by how powerful the iPhone GPU is. It can
             | indeed lens the input from the camera at high resolution
             | and in real time with high FPS.
        
               | lagrange77 wrote:
               | Cool, thanks for the reference!
        
         | jtbayly wrote:
         | I was able to install it on my M1 Mac, fwiw.
        
       | Y_Y wrote:
       | This is not a simulation of a black hole, but rather an image
       | filter that emulates one particular effect.
        
         | lupsasca wrote:
         | 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).
        
           | hnuser123456 wrote:
           | 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.
        
             | lupsasca wrote:
             | Glad to hear you're excited about BHEX---we are too!
             | 
             | If you want to read more about what it's going to do, I
             | wrote a blog post about it on the mission website:
             | https://www.blackholeexplorer.org/bhex-blog/lupsasca-
             | stateme...
        
               | hnuser123456 wrote:
               | Read all of it, only question I have is... napkin math,
               | how much more resolution over EHT alone?
        
           | Y_Y wrote:
           | 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/
        
             | lupsasca wrote:
             | Yes, such a great game---it's a fantastic visualization of
             | special relativity and also fun to play!
             | 
             | I think we're still a ways off from real time GRMHD sims,
             | but CK Chan from UArizona had a working VR simulation (on
             | the Oculus iirc, but now deprecated) that allowed you to
             | explore a pre-existing GRMHD simulation in real time and in
             | 3D. I think he might be working on a new version of this.
        
               | Y_Y wrote:
               | That's awesome. It's extra crucial to have engaging
               | outreach when your research is so far from application.
               | There's so much scope for wowing people with astro and if
               | you can enrich our culture and justify funding at the
               | same time that's a win-win.
               | 
               | (Just for clarity the second R in GRRMHD is for
               | radiation. I know it's typical to just push some photons
               | through the GRMHD results to produce renders, bit since
               | I'm dreaming let's treat the radiation self-
               | consistently.)
        
       | mock-possum wrote:
       | 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.
        
         | graveltr wrote:
         | Good point. In a future update, we can add a button to show /
         | hide the camera views.
        
       | spaceisballer wrote:
       | 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.
        
         | lupsasca wrote:
         | 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?
        
       | blululu wrote:
       | 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.
        
         | lupsasca wrote:
         | 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...
        
       | xqcgrek2 wrote:
       | As always, wonder what a particular "free" thing is selling and
       | to whom. In this case it's something called BHEX, to NASA.
        
         | lupsasca wrote:
         | 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.
        
       | consumer451 wrote:
       | First thing I wondered is what would happen if I pointed it
       | another screen, with an image like this loaded. I realize that
       | it's not realistic due to the z-axis, and field of view, but it's
       | pretty fun.
       | 
       | https://esahubble.org/images/heic0609a/
        
       | insamniac wrote:
       | As above so below. I love how it looks so similar to a
       | colonoscopy.
        
         | lupsasca wrote:
         | There are other apps out there for this kind of black hole
         | vision...
        
           | beretguy wrote:
           | Dude, I like your comments.
        
       | floxy wrote:
       | Would a person notice red-shifts from the black hole as well?
        
         | lupsasca wrote:
         | 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.
        
           | floxy wrote:
           | 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?
        
       | bossyTeacher wrote:
       | 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?
        
         | graveltr wrote:
         | 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.
        
           | CuriousSkeptic wrote:
           | Glad to hear, blocked install for me, so a bit more than
           | pedantic :)
        
       | gigatexal wrote:
       | Instant download for me. I'm a sucker for anything black hole
       | related.
        
         | lupsasca wrote:
         | Glad to hear that! You'll probably also enjoy reading about the
         | Black Hole Explorer (BHEX): a proposed space mission that will
         | take the sharpest images in the history of astronomy and
         | resolve the "photon ring" of orbiting light around a black
         | hole. https://www.blackholeexplorer.org/
        
           | gigatexal wrote:
           | I had no idea! Thank you!!
        
       | majgr wrote:
       | Is in the middle of black hole zero gravity? Then, is there
       | another event horizon somewhere inside black hole?
        
         | alex_suzuki wrote:
         | I don't think anybody really knows what's inside a black hole.
         | That's kind of their defining property.
        
           | grahamj wrote:
           | Of course we do - everything that fell in but wasn't radiated
           | out ;)
        
         | seanw444 wrote:
         | 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.
        
       | codethief wrote:
       | 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?
        
       | neallindsay wrote:
       | Another nice feature would be if it could simulate an accretion
       | disk.
        
       | aljgz wrote:
       | No plans for an Android version?
        
       | elashri wrote:
       | 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.
        
       | ilrwbwrkhv wrote:
       | Oh man this so reminds me of the old iPhone apps which were so
       | epic and so cool
        
       | ale42 wrote:
       | 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?
        
         | pokstad wrote:
         | It does
        
       ___________________________________________________________________
       (page generated 2024-11-19 23:00 UTC)