We’re pretty proud of the lunar landscape we were able to scrape together for BROVER. It’s not to scale and the textures are repetitive, but we think it has a nice look:


Getting this effect in Unity was actually a little weirder than I expected. At first we tried to get some height map data of the moon. While there is quite a bit of height data available, it was a little unwieldy for us. So Jose Mayo, our modeler had the great idea of generating a displacement map from an image of the lunar surface.

It took a fair amount of trial and error from there to get it working, so I’ve decided to put this little lunar landscape tutorial together.

Start with an interesting image of the moon’s surface. Jose grabbed a high resolution image of the moons surface from the NASA resources and chopped it down to this:

The Dark Side of the Jam people put together this nice collection of resources you can explore: http://www.darksidejam.com/assets/

Then generate a displacement map with CrazyBump or NDo2. We used CrazyBump:


I thought I could just import the displacement map .png into Unity, unfortunately you can’t.  So you have to convert the displacement map to the .raw format. It caused me a lot of headache at the jam trying to figure out exactly how to get an image imported properly. Eventually I figured out how to do it using ImageMagick. If you’re on Mac and can stomach command line, you can use ‘brew install imagemagick’ to get ImageMagick (to get brew go here) After ImageMagick is installed then this line will convert your image file to a height map:


convert MoonTerrain.png -size 1024x1024 -endian LSB gray:MoonTerrain.raw


Assuming the file MoonTerrain.png exists in your working directory. Otherwise if you have photoshop, you might be able to save out the .raw file with the image mode set to 16bit grayscale.

After you get your .raw heightmap file, you can import the height map into Unity by selecting ‘Terrain > Import Heightmap’. We imported the terrain with these settings:

Now don’t worry if your terrain looks something like this:


To see a higher detail terrain, turn down the ‘Pixel Error’ to 1 in your terrain settings and make sure your game camera is above the terrain.


And you might have to go to ‘Terrain > Set Resolution’ and mess with the terrain height a few times until it looks right.

White I was figuring that out, Jose made a few textures for the terrain, and generated some normal maps for them. You can add a texture to your terrain in the ‘Paint Textures’ section of the Terrain settings.


You can add the normal map to the terrain too, but it won’t use the normal map unless you create a Material with a terrain shader and set the terrain to use it.


Create a Material that looks like this, then add it to the terrain in the terrain settings:


The terrain now looks slightly better because it’s using the normal map:


The last touch, is the sky and lighting. There is no atmosphere on the moon, so there will be no reflected light from the sky, and there will be no fog. Even though that looks pretty cool:

Switching off the fog and removing the ambient light gives a more lunar effect:


If you already knew a bunch of stuff about Unity 3D and followed these instructions, you should now have a little chunk of the moon sitting in your view port:

We took this chunk and used it as the surface for our game B.R.O.V.E.R.

What you do next with that is up to you.


  1. broverthegame posted this