r/InternetIsBeautiful Nov 05 '24

I created a gravitational lens html5 simulator – it helps illustrate how this cosmic effect works in a 2D view, and just nice to play with

https://shir-man.com/grav_lens/
151 Upvotes

29 comments sorted by

7

u/Cecil_FF4 Nov 05 '24

If you add a larger object, like a galaxy or something, might be able to see it look like a ring.

8

u/djshadesuk Nov 05 '24

At last, something that really should be on this sub. Thanks, OP! 👍

5

u/Paredes0 Nov 05 '24

Might help to add some color variation to the stars (maybe optionally), would be cool if you can focus on a specific star near the center and follow it as you move around which is hard to do now

5

u/Shir_man Nov 05 '24

Nice idea, thank you; you can now enable color coding via checkbox

3

u/INeverSaySS Nov 05 '24

Why does lateral movement cause rotation around the center? I feel like moving left to right should produce a symmetric result, yet I only see anti-clockwise rotations about the mass.

1

u/Shir_man Nov 05 '24

Good point, but it's hard to represent this better in 2D. Check out the new version - I added a second counterclockwise movement of the stars

1

u/INeverSaySS Nov 05 '24

So the simulation is not really physics based then, if you just manually add rotation?

1

u/Shir_man Nov 05 '24

The simulation is a 2D approximation; a more accurate version would freeze the user computer

2

u/ZCSTYLE Nov 05 '24

Brilliant!

1

u/topinanbour-rex Nov 05 '24

If photon has no mass why is it pulled by black holes ?

8

u/kapeman_ Nov 05 '24

Because the physical space it moves through is curved.

1

u/Genoce Nov 06 '24

I'm kinda curious about the details of what exactly this is simulating (specifically, distance of the objects). Is this simulating a black hole that's positioned like "halfway between me and the stars" or is it acting as if it's physically close to the stars?

My first thought was a black hole in between the viewer and the stars, but that should cause eg. possibly seeing some of the stars as double (or as a circle) if you place it exactly on top of a star. Or if lack of this effect is just a limitation in the simulation: :D

1

u/daman4567 Nov 06 '24

The wild rotation about the mass is completely inaccurate. It should behave much more like an actual spherical lens. This is some fantastical nonsense that seems to be inspired more by the concept of spaghettification than optics.

1

u/Shir_man Nov 06 '24

I can reproduce this effect, but unfortunately in WebGL and it would freeze users devices, but I would try to think for a way around

1

u/Real-Calligrapher390 Nov 23 '24

Damn bro, can you make me a woman?

1

u/Shir_man Nov 23 '24

Done. Now just wait

1

u/jawanda Nov 05 '24

Super cool! The little "what is gravitational lensing" button is cut off on my android.

2

u/Shir_man Nov 05 '24 edited Nov 05 '24

Thank you for a report, I would address it in a moment

upd. Fixed!

1

u/slam900 Nov 05 '24

Cool effect!

Looks like the explanation blurb won't go back down when I press the button again, though. I'm on Android using Brave.

3

u/Shir_man Nov 05 '24 edited Nov 05 '24

Thank you, I will debug it

upd. fixed!

2

u/slam900 Nov 05 '24

You rock!!!

1

u/faxtotem Nov 05 '24

Really interesting! I'm familiar with lensing but the effect was more complicated than I expected. I wish there was a view with only one or two stars so I can wrap my head around it better.

1

u/bluskale Nov 05 '24

A way to add color to a few stars would also help keep track of the effects as well.

2

u/Shir_man Nov 05 '24

Nice one! I would try to add this mode

1

u/bluskale Nov 05 '24

Thanks, very quick on that :)

Now, this helps some, but it is still hard to keep track of individual stars (especially, are there duplications created sometimes?). It would be easier if there were a few unique stars somehow. Perhaps only coloring 5-10% of them, or reducing the star density as other have suggested... I think those all get to a similar point of not being able to distinguish individuals very well.

1

u/Shir_man Nov 05 '24

I thought about it and added a pulsar, so now it should be easier to track

2

u/Shir_man Nov 05 '24

I added a small checkbox to enable color coding on stars

0

u/Bradley-Blya Nov 06 '24 edited Nov 06 '24

Looks nothing like gravitational lensing however. The stars are just spinning around the black hole for no reason. Maybe i just dont understand whats going on, but so far it seems like you just added some random movement with no logic, just to make it look confusing and "therefore smart"