December 8, 2015

Terrains

New planets need new terrains that also utilize my shader.

spoiler SPOILER ALERT

Before I got started converting the terrain textures, I had a problem to solve.

When OpenGL draws a portion of a texture, it often has to sample pixels around the pixel it is drawing to determine the final color. If this happens to be at the edge of tile in a multi-tile texture, it will sample from the tile next to it. If the tile next to it is a vastly different color, you’re going to see ugly lines between your tiles when they are drawn.

One way to solve this problem is to put a border around each tile that matches the color of the edge of the tile. I really didn’t want to do this because I have 16 tiles that would fit perfectly in a 128x128 texture.

Thankfully, there is a way to organize the 16 tiles so that adjacent tiles always match. That layout looks like this:

With new textures and shader, I updated spacedust terrains to match what the planets look like from space. Here are what some of the new terrains look like:

New planets and terrains will be included in the next version of spacedust.