Whats is the best algorithm to create a landscape?
I would like to render it in triangles.
The “best” algorithm depends on your porpoise.
Every technique have is cons and pro, there is no ultimate landscape technique.
First of all, go here -> http://www.vterrain.org/ <-
Then start asking yourself:
I need roads, tree, water? How many trees? How big must be my terrain?
From which distance I’ll see my terrain? I want to walk over it? I want to fly over it? With a plane? With a dragon/unicorn?
My program must run on old hardware?
When you have more detail ask again.
Recent improvement help a lot in terrain rendering, a good combo can be using transform feedback to generate the vertex and geometry shader to draw the mountains silhouette.
By the way, I’m still looking for more detail about this technique:
Another easy to implement (but with a lot of cons) is using geometry clipmap:
It is rely the simplest landscape possible. No forest, roads etc. Just some textures and bumps on it. The size does not realy matter. I can fall over the edge it does not rely mather. It is only for demonstration purpose.
Moving around. Is just like the view of a flying camera. Nothing else.
The most simple technique is:
Drawing a grid with 512 x 512 vertexes, and from an height map the displacement. (half an hour of work)
You will finish you memory quite really soon.
Then you think that an adaptive approach is better.
An old algorithm (but still good) is ROAM
All the computation is done in CPU, but it’s ok for simple application, you can find libraries that implement it.
If you want to transfer some work in your GPU try to use geometry clipmap (the last link in the previous post), it can render really big landscape but require vertex shader to read floating point texture (GeForce 8 or above). With this technique all computation is done in GPU, you only have to draw some grids.
Did you take a look at vterrain.org, there are a lot of algorithm and articles.
Couple issues to think about when you’re deciding what you need.
Do you need cut-in features, like rivers, lakes, roads, etc. How should these LOD as the terrain LODs? What about buildings?
How smooth do terrain LOD transitions need to be?
What kind of lighting/shading/texturing do you need on it? (some terrain algs hand-wave texturing)? What min/max texture resolution do you need?
Is the terrain small enough to load on startup? Or do you need to load-as-you-go?
How much GPU mem can you devote to it? Does it matter to you if you upload a boatload of verts and spend a lot of vertex transforms on the GPU to render flat terrain where 10 tris would have sufficed?
Does it matter to you if the silhouette of that mountain in the distance looks pretty sad because the tessellation algorithm doesn’t use curvature to determine where to spend verts?
How much frame time can you afford to spend trying to find the right triangle mesh every frame and batching it efficiently (view-dependent LOD, etc.)? Do you need to do this at run-time?
Can you presume tessellator-capable GPU?
Thanks for input. Maybe I will bump this thread in the future.