f0ssel

New Terrain Colors and Grid LOD System

3 min read #gamedev

I’ve revamped the terrain UV system to better suit the new texture design I had. Before I had a simple grid of 4 colors, and the height of the triangle’s vertices dictated which color was chose. Now, I’m using a fancy looking blurred gradient, and the height of the average of the 3 vertices are now scaled to a number between 0 and 1, and then used to choose the Y component of the texture gradient. The X scale is randomly selected at the moment, but I will most likely use a noise function in the future. This is nice because I can go in photoshop and add little details of darker and lighter colors to give the overall terrain a little more variation. It’s made with layer masks, so I can easily change the layer colors without disrupting the other colors or heights of the transitions.

TerrainBlur.png

islandGen04

I’ve been working on adding smaller lakes to the plains areas of the island and messing around with the Selector function in libNoise has gotten me more familiar with how it works. Hopefully soon I can re-write my noise generation function to include sub-biomes and overall be more expandable in the future.

islandGen03

I’ve also run into the same problem Facepunch, the developers of Rust, ran into a while back, and that’s having too make LOD Groups in the scene. Since the island is so massive, I was hitting this cap when I tried to add trees. Like Facepunch, I used my already existing grid system to create a LOD Group per grid. Getting this to work is a small milestone for me, since I had no understanding of how combined meshes worked before I tackled it. Basically, for every chunk, the trees get placed on the terrain. Each tree gameobject is actually a LOD Group, with 4 LODs. I took every LOD0 (highest quality) LOD mesh from every tree gameobject on the mesh, and combined them, and made a new LOD0 with all of them combined. I do this for every level of detail for each object. This results in every item on the chunk changing detail at once instead of every item doing so independantly. This drastically helped performace as well. Right now all objects stay active all the time in the scene. They simply get culled once they are too small in the camera space. There’s still issues to be worked out, I would much rather the LOD system be distance based instead of camera space percentage, since the angle of the ground can make that percentage change drastically. But it’s a great start for me and is keeping performance within reason.

islandGen07

islandGen06