About

For my final project I created a fancy renderer for an n-body simulator I wrote a few years ago. The two main features this project showcases are the shadows cast by the planets, and the bloom lighting effect present around bright objects.

Shadows

The "Shadows" in this project are merely an object with transparency that is drawn into the world behind each gravity object except for the sun. They are scaled based on the object that they are attached to, and I do some vector math so that they always point directly away from the sun, and so that they are always perpendicular to the camera.

Bloom

The bloom effect (the way bright lights cause light to spread beyond the border of the object) is achieved by first rendering the entire scene onto a texture, then drawing that texture onto the screen with a special shader that adds the bloom lighting effect. I could not figure out how to enable true HDR (high dynamic range) (HDR allows colors with values over 1.0) for this texture, so I use a hacky workaround. The color of everything sent to the texture is divided by 2, and the final rendering stage that applies the bloom multiplies all colors by 2, and spreads out any color greater than 0.5 (or so, some funny math is involved to make it look a little smoother).

Libraries

The only library I used for this project is LWJGL, which provides a barebones wrapper for OpenGL and some user input / display setup code.

In the beginning

there is an asteriod belt.

The asteriods collide

to form larger bodies

which have fancy little trails behind them.

Shadow size and darkness is scaled based on the size of the casting object

and by proximity to the light source.

The camera can move around the scene with wasd & mouse.

The tails can be extended with commands to stdin.

Eventually, a stable system is formed.

Some objects are thrown into highly eliptical orbits, far away from the sun.

Meanwhile, the inner system usually stablizes into one or two larger "planets".

Random Glamour Shot 1

Random Glamour Shot 2

Random Glamour Shot 3

Wait What?