Get Updates By E-mail 

Article Written By:
Johann Dowa

Example: Rendering The Milky Way Galaxy On iOS Devices Using OpenGL ES

I’ve mentioned some excellent beginner tutorials on using OpenGL ES, here’s an advanced example on using OpenGL ES using a different approach to render the Milky Way galaxy.

The Milky Way contains over 200 billion stars and here’s an example from Hanno Rein that uses some interesting techniques to render this overwhelmingly large structure.

The example uses a background texture map, a dust map for determining the depth of each point, and uses point sprites to create the 3D points altogether with some custom vertex and fragment shaders.

Here’s a few images showing the example in action:
Milky Way Galaxy-1

Milky Way Galaxy-2Milky Way Galaxy-3

As the readme states:

This is an example project to show how to render a Galaxy in OpenGL on the iPhone. To simulate interstellar dust realistically with unsorted point sprites in OpenGL, I’ve implemented a GPU based ray tracing algorithm.

You can find the OpenGLMilkyWay example on Github here.

You can find this example in use in Hanno’s impressive ExoPlanet app.

There’s a PDF included in the Github repository providing some slides explaining a bit more into the techniques used for this impressive example.

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.