HeightField Terrain, very large with "good" performance

I started building out a terrain project and got a bit hooked into doing it with shaders and pushing performance.

The Terrain is currently very repetative, and poor quality, partly due to the source image I found on the internet. My next step is to generate nicer heightfields and also allow mapping large area rather than just repeating the height map.

Anyway, for performance triangles get bigger in the distance, it does frustum culling and it pre cooks lighting and texture lookups (actually it’s just color not textured at the moment).

You need the following image in your coda dropbox https://www.dropbox.com/s/56l7cu0nckokie0/terrain_map6.png?dl=0

Code here: https://gist.github.com/sp4cemonkey/3373a25556dba6984124

Hi @spacemonkey,

Sooopeeerbbb!!! This will take me months to digest and understand. Thanks for including the references. Got a small project that may use a teeny bit of this.




WOW! Superb!

I’ve started working on procedurally generating the heightfields to 1) get away from a fixed image and 2) be able to generate much bigger heightfields to get away from the current repeating terrain.

It’s interesting stuff, but currently my terrains are very ugly and unrealistic…

Found this quite interesting article though http://www.float4x4.net/index.php/2010/06/generating-realistic-and-playable-terrain-height-maps/

Going to try this one over the next few days and see how it looks.

I’ve worked in the past with procedurally generated terrain, here were my results:



I can share my code if you want to see how I went about doing it.

P.S. Your shadow maps are amazing, I will never figure those out.

@SkyTheCoder thanks for the offer, but I’ve got something working that’s not too ugly, now gonna work through trying to tile it up so I don’t get the repeating terrains on the rendering side… I can always come back to terrain generation techniques later.

The shadows here are a total cheat that I got inspired off from the web. Proper shadow mapping is tricky, and also slow if you are doing it real time, what I do in the light shader here is just step across the heightfield texture looking for high points and cooking it in during setup. The big cheat is shadows only fall across the x axis which makes the lookups dead easy :wink:

Does anybody have the terrain image @spacemonkey posted above?

I’ve found various maps online and they look pretty cool on this project but I’d love to see the terrain he intended.

Plus then I can make a nice zip file of it and upload it to this thread.

I found a terrain map online that works ok but the colors are pretty ugly. Still I think it shows the project working, and so I’ve attached a zip. Would love to find a better map though.