Tag Archives: textures

Make It Terrain!

We made a big decision in the last few weeks to move away from using Unity’s built in terrain system completely.

Unity’s terrain engine uses height-map and splat-map data for displaying terrain heights and referencing texture blending that is plugged into a multi-purpose component for things like detail batching, trees, texture painting, and more.

We’ve been using these components in re-usable terrain tiles for displaying our procedural generation data, which was not intended for runtime manipulations.

We wouldn’t go as far as saying we’ve created our own terrain engine, but rather a new way to display our procedural data in a much more appropriate and efficient manner for our scenario.

Shore

 

Mesh

Because the procedural and visual calculations are separate systems it made the switch fairly simple to convert the heightmap data into mesh data by assigning height values to each vertices.
 

Textures

Texture splatting is now solely based off the height-map data with different height graduations for the individual layers (coral, wet sand, dry sand, grass, etc). This means we were finally able to scrap the multiple splatmap texture lookups in the terrain shader which was really eating performance! Now, all the work is done inside the shaders. This has also freed up some resources so we can have much better blending effects between texture layers and some more fancy displacement effects.
 

Details

One reason we hadn’t made the switch earlier is that Unity’s terrain engine does quite a good job at batching and rendering all the terrain details (grass, small rocks, etc) ..but it is also very memory-heavy.

I made the decision to incorporate terrain details into a previously made grid-based spawning system for random world debris (similar to the world generation). This actually helps a lot with memory consumption, as objects are being recycled and only generated around you based on seed values.

TerrainDetailShifter
Reefs

 

So what does all this mean for you?

Well, the system is fresh and far from optimised at the moment, but we’ve seen equivalent or better performance compared to the old system with a boost of roughly 20 frames per second in parts and a significant decrease in overall memory usage.
There used to be a slight hitch transitioning between world tiles with the old system, and it’s barely noticeable now. There’s still some work to do to the new system. Things like terrain mesh LOD and culling; detail batching and LODs, will all help with the overall performance. We can also look at pushing detail into small areas with tessellation and all sorts of funky shader stuff. So it might seem like a weird late change at this point, but it’s definitely one for the better.. more importantly, it means we know our systems inside and out so if anything breaks, we know exactly what and why.

To celebrate the new terrain system I dabbled in some terrain textures, here’s a couple of them 🙂

Coral_Texturejpg
RockTexturejpg

It’s been a slow couple of weeks for us this time around.. but everything’s moving forward. It’s down to a lot of annoying fixes and small changes now..
So that’s it for this update. Be sure to stick around for more updates and announcements!

— Ben

Tagged ,