Planet Renderer


This shows my ability to acquire many new skills quickly and apply them successfully for a single project. It also shows my ability to adapt to and resolve issues such as numerical precision, as well as my ability to design and evaluate, as well as implement new designs when existing approaches are not the best fit.


I've done extensive graphics programming, including this realtime procedural planet generator and renderer. For this project, I learned about:

  • Python
  • the CG shader language
  • how to use the Panda3D game engine
  • matrix mathematics for spacial transforms
  • procedural graphics and terrain generation
  • numerical precision
  • offscreen rendering

I also use many existing skills on this project, including:

  • 3D graphics

I've also worked on several terrain renderers not directly related to this one, including my open source terrain system.

Goal and Design

This procedural renderer is by no means particularly realistic or detailed, but it accomplishes its goal, which was to make a simple and good looking planet renderer that renders and interactive frame-rates without any preprocessing. The approach I used to render the surface of the planet, a single grid deformed and placed in a vertex shader is unique as far as I know, and performs very well. I came up with the design after consulting a fellow programmer who had previously worked on a similar project, as well as studying various common algorithms such as time based cube subdivision or icosahedron subdivision. My approach was far simpler to implement and can generate a view from scratch without pre-computation much faster. It does have some major limitations as far as terrain detail goes, but highly detailed 3D terrain was not the goal.

Rendering Algorithm

The planet viewer is fully interactive and generates the planet in realtime. The planet has a minimal low resolution climate map pre-rendered also using CG shaders which is generated in an offscreen buffer at launch. This, and the current camera position are then provided to the main shader which is applied to a simple grid. This shader deforms the grid to cover all visible parts of the planet with the highest mesh densities nearest the camera. To resolve the precision issues with the smaller scale/higher frequency features, they are generated from a tiled cubic grid. A grid point near the camera is computed on the CPU using doubler precision matrixes, and the position relative to the camera is then provided to the shader and use as an origin for the small scale content. Everything in the shader is based on the point under the camera, and the local origins for small scale features, which solves the precision issues allowing the camera to view somewhat decent rendering all the way down to a few meters above the surface on the Earth sized planet.

The atmosphere is rendered additively, and is a simple sphere around the planet with a shader that accounts for the angle between the sun and the point in the sky, as well as the viewer height.

There are additional images on the website of the project for which I originally started this project.


Video is a collection of realtime recordings of a user navigating around a planet in the generator/viewer.

Copyright © 2011-2013 Craig Macomber