Lacuna Passage - Devlog #2 - Building Mars Part 2

Continued from Devlog #1 – Building Mars

Since the terrain in Lacuna Passage is essentially its own character in the game I decided to drop the composite Photoshop method and look into generating higher fidelity terrain directly from the Mars HiRISE digital terrain IMG files.

userprefs_blender.jpg

As it turns out, there is an add-on for Blender that allows you to import the large IMG files to generate a mesh. Huzzah! Exactly what we need.  There are others who have already documented precisely how to utilize this add-on so rather than reiterate their instructions I will simply link to a tutorial video that explains the process very well.

While Blender is great (and free) I preferred to export the final mesh to 3ds max to create our heightmaps. Once in 3ds max you will likely need to flip your normals so that we can unwrap the mesh correctly and generate a heightmap.

standardmat_heightmap.jpg

As we already know, a heightmap consists of a black to white gradient to convey height, so we need to devise a material for this mesh that will render that gradient. The easiest way to do this is to apply an unwrap modifier to your mesh and planar map the entire thing from either side (doesn’t matter which side, just NOT a top down plane). Then we can apply a black to white gradient material with 100% self-illumination. These steps are probably easier to follow in video tutorial format, so once again I will link you to someone who has already explained the process quite well.

UV_layoutheightmap.jpg
gradientmat_heightmap.jpg

Once you have your gradient material applied to your mesh you can effectively render out whatever sized heightmap you want. Obviously you will have diminishing returns at a certain point where the resolution of the mesh itself limits the resolution of the heightmaps you can render, but these are still much higher quality than the jpeg images provided via HiRISE.

heightmap_render.jpg

Now you might be asking, “But how do I ‘customize’ my terrain? It seems like I’m limited to only the geometric features provided in a single HiRISE IMG file.” This is true; however, this is where we can implement a new method for compositing. If you have access to Mudbox you can create sculpting stamps from individual components of your rendered heightmaps. For a third and final time in this devlog I will defer to other skilled artists and link you to an example of how this could be used to create some of the most realistic custom terrains you will find anywhere.

mudbox_heightmaps.jpg

During the development of Lacuna Passage we will be using a combination of nearly all the methods described in this post and the post from last week. The game will have an expansive open-world terrain and the goal is to make every inch of it worthy of exploration. Make sure to follow us on twitter and facebook for more updates.

Lacuna Passage – Devlog #1 – Building Mars

Welcome to the very first official Development Log for Lacuna Passage. This game has been a pet project of mine for the last 6 months or so and I am finally at the point where I would like to start talking about exactly what I am working on.

screen_day_1.jpg

I’ve always been a huge fan of space exploration and the recent success of the Mars Curiosity Rover inspired me to make a game that embodies the nature of exploration and discovery. Lacuna Passage is that game. I wanted to create an experience that might fulfill my own desire to set foot on another world, and for the last 6 months I’ve been researching and prototyping exactly how I might do that.

When I started the project I tried to get a sense for the types of games that have attempted this in the past. From what I noticed it seemed that many space exploration games focus on some kind of tension mechanic. You have limited oxygen, you are being hunted by mutant aliens, you are trying to survive or fight… Games like Dead Space, Metroid Prime, or Mass Effect, and many of these take place far in the future where we lose some context for the difficulty and high risks associated with space exploration. Everyone has a spaceship, and things like gravity, physics, and engineering are trivial matters. On the other end of the spectrum are the space simulators (Kerbal Space ProgramUniverse Sandbox) that don’t have a story to tell, they simple try to replicate the nature of space or space travel. There are very few games that sit in between those styles. I wanted to create something contemplative and awe-inspiring, not fear-inducing or pedantically accurate. I wanted to create an impressionist representation of modern space exploration. Think Dear Esther in space.

boring_mars.jpg

Mars was and has always been a particular fascination of mine so it was only natural to have the game set there. However, I quickly realized that Mars is a fairly dull landscape. It is certainly nothing like the bright reds and oranges you might imagine or that have been depicted by Hollywood. In reality, most of Mars is relatively flat and brown (as can be seen in some of the amazing images sent back by the Curiosity Rover, including the one above). I set out to create a “hyper-real” version of Mars that combined its true features with something that might satisfy our imaginations.

The first step in this process was to find out how much real Mars data I could incorporate into the generation of the game’s terrain. When I discovered the Mars High Resolution Imaging Science Experiment (HiRISE) I started getting really excited. The problem then became how to utilize this newfound data source in relation to terrain generation.

The HiRISE site features several hundred independently scanned locations with various formats of image data. Best of all, there are absolutely no copyright concerns. All images are public domain. Science is awesome.

When you enter the page for a particular scan you are presented with several image links. On the left you will find the raw image data in .IMG format, but they are giant files that you can’t just open up in Photoshop (we will talk about those more next week).

color_altimetry.jpg

In the middle of the page you will find links to some standard .JPG images that feature various representations of the Martian terrain. Most notable are the Color Altimetry images (as seen above) that show the relative heights of geologic features according to a color gradient. While informative (and very colorful), they are unfortunately not very useful to us for direct application in a game engine. Luckily, we can find another type of image file here that will likely be familiar to anyone who has dealt with terrain in any modern game engine. Though they may not call it by the same name, the HiRISE project has seen fit to supply us with grayscale heightmaps. For those unfamiliar, a heightmap is an image that communicates height data via pixel grayscale values. Simply put, the whiter the pixel, the higher the altitude. These are invaluable in the production of high quality terrains that can tessellate their mesh data depending on the location of the player in the game. A much more optimized solution than using giant static meshes to build the terrain.

stepped_terrain.jpg

Unfortunately, the rendered heightmaps provided by HiRISE are only 8-bit images that do not contain enough data to translate to smooth terrains. Using these images alone will result in a “stepped” effect where the grayscale transitions are too harsh.

If you would like to use these 8-bit heightmaps there is still hope for you though. With some experimentation I was able to convert the 8-bit images to 16-bit RAW in Photoshop and then downscale them and composite several together to form a full 2048x2048 scale heightmap that renders in Unity quite well. By getting creative with cutting and pasting different features together you can composite very large heightmaps with very little noticeable stepping. You can always add a slight blur effect after converting the images to 16-bit, though this may result in a terrain that is smoother than you would like.

composite_heightmap_1.png

If you want to take your heightmaps a step further you can effectively “post-process” them in a procedural erosion simulator like World Machine to add in detail that was lost in the conversion from 8-bit to 16-bit. Since World Machine is a fairly complex application I won’t go into a step by step tutorial, but you can easily import your composite heightmap and run an erosion simulation on it and export a new, higher-detailed heightmap to be used in your game engine. (This tutorial sums up the process pretty nicely). You could always start with World Machine directly to procedurally generate your entire terrain, but in my case I wanted to use the exact features from Mars as scanned from orbiting satellites. It adds a level of authenticity that still allows for creative rearrangement of features to suit my game.

screen_day_2.jpg

I was fairly happy with this workflow for quite some time, but the composite method for creating heightmaps becomes a bit more difficult when working with giant terrain sizes like the ones used in Lacuna Passage (8192x8192). Ultimately the fidelity of the heightmaps fails and it becomes too much of a jigsaw puzzle to find the appropriate images to composite together. I’m sure that others may find this technique satisfactory, but next week I will talk about how you can utilize the actual raw data from the larger .IMG HiRISE data files to generate your own high-poly meshes and render your own (incredibly large) heightmaps.

Continued to Devlog #2 - Building Mars Part 2