This week I changed the biome ground material and water material to have smoother transitions. Originally I used if statements to select the biome color, but if statements are pretty terrible for performance because graphics cards are designed to do lots of calculations in parallel; they can’t nicely handle branching code. The if statements also made the effect break down as the camera got closer to the transitions. Initially I tried replacing the if statements that selected the biome color with a smoothstep() combined with linear interpolation. This didn’t look very good and highlighted the blockiness of the biome mask texture. So instead, I tried a happy medium between the two methods, where I used a smoothstep() with a min of 0.45 and max of 0.55. I’m pretty happy with the results, there are very tiny transitions between biomes; in-game it looks very similar to the old version but without the aliasing. I used the same method with a bigger transition size for when three or more biomes meet.