Saturday, June 7, 2014

A better reflectance model for the moon

Here is my second post on my recent activities on planets rendering in Stellarium.

One thing I always disliked in Stellarium was the rendering of the Moon. It always looked like a giant 3D sphere with a "computer graphics style".

The reason for this is that we were until now using a basic Lambertian reflectance model. In other words, it means that we assumed that the light coming from the sun was reflected equally in all directions by the Moon's surface. The Moon being a sphere, this implies that the center of the full moon was brighter than the edges, because the light coming from the Sun comes perpendicular to the moon surface. And this produces something like that:

Notice how the center of the moon is brighter than it's edges
For comparison here is a beautiful picture of the moon taken from earth:

Image from this Wikipedia page - Copyrights Luc Viatour - CC BY-SA 3.0

Notice the "flat design" look & feel? (At least something Apple won't be able to patent because of prior art ;) )

The reason of this is that the Moon's surface is composed of a rough material, and that rough materials are not well modelized by Lambertian model. For such surface, one option is to use an Oren-Nayar reflectance model. Based on this article I was able to quickly implement something, and here is the result:

OK, it's still ugly, but it's already better..

What's next? Maybe try to add normal mapping, to simulate relief and adopt nicer textures.

1 comment:

  1. Hi! We already have code for normal mapping (SOCIS 2011), but now it required porting and cleaning.

    ReplyDelete