30 klicks of double-gravity terrain

A *very* early test of the new terrain

I was torn about whether to write an article at this early stage of development. However, since ground missions represent about 50% of the remaining work, it’s either show you progress now or a huge wait till the next update. Please be aware all textures shown are just placeholder.

Original terrain and heightmap

I can still perform miracles with nothing more than a socket-driver and a pile of junk parts.

Oh boy… Wing Commander IV’s original terrain—there wasn’t much to work with. I won’t go into too much detail as wcnews has already covered it! Each “mountain” was just a single height value, and as you can see from the example image, sometimes lakes defied gravity, or terrain appeared under buildings. Modernizing this aspect of the game was a task.

The first step was to add tessellation support (scaling polygon density based on camera distance). Even without modifying the heightmap, this improved the geometry: instead of a sharp, pyramid-like peak, the use of linear texture sampling produced smoother, curved hills. Still, the results weren’t acceptable—too many equally sized smooth hills were conspicuous.

The vertex shapes produced just by tessellating the original unaltered heightmap

Gamma rays are clouding their screens

Even at this stage, the discrepancy between the collision geometry and the visible geometry was a concern. After adding a secondary heightmap in the shader for more detail, it became clear we couldn’t achieve good results without adjusting the collision.

So, we moved terrain generation over to the CPU and followed these steps:

  • Upscale the terrain by 8x
  • Create an incline texture
  • Merge in a repeated low-resolution detail map, scaled by incline

This was a significant visual improvement, which also worked for physics.

A shot of the classic terrain in engine

While this was a marked improvement, it still wasn’t “modern.” The terrain lacked normal maps, and the detail was still relatively coarse. At 8K resolution, the height texture alone was 256MB, so pushing this further on the CPU wasn’t practical.

We returned to the shaders, applying a second detail map that subtly offset the tessellated geometry. More importantly, we sampled in multiple directions to create per-pixel normals, giving the illusion of even more detail without needing extra textures.
The incline texture was useful for automatically assigning textures, as well as determining the amount of tessellation (the steeper the terrain the more triangles you need to represent the detail).

Shadows introduced their own challenges, as the geometry tessellates based on camera position. Therefore, tessellation needed to match the main scene for the shadows to display correctly.

The exact same location with the new terrain

Next Steps

As you can see, there’s still a long way to go. Defiance Industries is working on real textures and tree models. We need to add lakes (not the ones in pits or on mountainsides), an atmosphere, clouds, and more texture variety. For the next few updates, we’ll likely be focusing on ground missions.