Relativistic lattice

How would the space look like if you were going really fast? You could find some videos if you know the key words, but not enough interactive stuff, so here goes one:

development screenshot

The history

Back in February 2014 I have discovered that, unlike what these scary papers and presentations might make you think, programming this kind of ray tracer is really straightforward. Since then, I was contemplating doing this on GPU, but AGAL kind of sucked and I knew zero GLSL to even start. A year later, I have found this shader and decided that it looks promising, but its performance sucked on every piece of hardware I own, and I had to look for the ways to make it work faster. This did not go well, again, and I have lost my motivation soon. But now, when the hard part is done, it was simply a matter of combining all the parts together – and so I did.

The math

Special relativity key equation builds upon the experimental fact that speed of light in empty space is constant (c = 299 792 458 m/s). It says that times (T) and distances (X) between some events, as measured by two observers, are connected by

c²T₁² – X₁² = c²T₂² – X₂²

(for events connected by light rays both sides are zeroes). The number of conclusions you can draw from this alone is fantastic. For example, if observer 1 is our spaceship, and events are its departure from Earth and arrival to some distant world, we have X₁ = 0 and X₂ = spaceship velocity times T₂ – therefore T₁ ≠ T₂ – the conclusion known as “twin paradox”. It also says that you could reach any place in the Universe in just two weeks if you fly sufficiently fast (but still slower than light), and – yes – I made space traveller calculator for that.

Any way… to be continued.

5 Responses to “Relativistic lattice”

  1. 1 Lawrie September 8, 2015 at 16:57

    This is great! But there seems to be a bug – I can’t go faster than C ;)

    • 2 makc3d September 8, 2015 at 17:06

      Good point. Although physically impossible, it might be possible to calculate what “unphysical” observer would see. The code “as is” will fail because of square root, and maybe other things, but I will think about alternative approach.

  2. 3 verteAzur July 3, 2016 at 19:57

    Hello makc3D,

    This is a great effect. We usually see beams of lights passing by the cockpit like in Star Wars movies, that simulate the “speed effect” distortions. We rarely have the chance to appreciate a well put together effect of that event.

    Will it be difficult to include your work into a generalized THREE.js postprocessing shader?

    • 4 makc3d July 3, 2016 at 20:50

      Nearly impossible, I guess, unless you do some clever pre-transform in all vertex shaders. Because your postprocessing shader would need an access to the back side of the objects which is invisible when v = 0.

      • 5 verteAzur July 3, 2016 at 21:11

        It might require complex mathematical formulas above my understanding. I guess users will have to content themselves of a “fake” effect emulation, the same as one will see through a Fresnel lance. Anyway, thank you for the info and the demo.

Ask a Question

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Old stuff

August 2015
« Apr   Sep »

Oh, btw…

%d bloggers like this: