vm6502q / OpenRelativity

An open source framework to add the effects of traveling at relativistic speeds to visualizations or games
17 stars 2 forks source link

Gravitational red/blue shift from lighting reflections #23

Closed WrathfulSpatula closed 4 years ago

WrathfulSpatula commented 4 years ago

A certain amount of red and blue shifting was already accounted from the player's perspective, as can be seen in the black hole demo scenes. What wasn't accounted for was the red/blue shifts between light sources and accelerated RelativisticObject instances. This PR adds handling for red/blue shift at point of reflection off these objects.

A RelativisticObject instance's "acceleration in world" ("aiw") is locally indistinguishable from the gravitational field it experiences, according to equivalence principle. Therefore, whether this acceleration is mechanical and uniform or a "real gravitational field" doesn't matter. Shifting the frequency redder or bluer according to the inner product defined by the metric, we make a (usually small) correction to RelativisticObject instance surface reflection color at point of reflection.