Yet another terrain issue

I’m trying to make a flight sim kind of game. Therefore I need vast terrains or the illusion of it. I know Panda gained the ability to generate terrains from heightfields and I can do that easily for a fixed scene. However, it’s never big enough for a flight sim. My first question is, does anyone have a suggestion about how to generate terrain on the fly? Or maybe another clever solution to this “huge terrain” problem?

Another thing is the famous “popping” problem in terrains. I’ve seen suggestions to use a per pixel lighting shader with normal maps to work around this artifact, however since there is no egg file around I don’t know how to get Binormal and Tangent information, making it impossible to implement a pixel shader. Any ideas?

Thanks!

you could set the “far” distance of the camera and then set a fog,
so not the entire terrain is rendered.

That is not the problem though. The problem is, how can I load a big enough terrain (or skydome for that matter) that will take more than 10 seconds for the plane to cross while keeping the illusion of speed.

Not a big problem. Just scale up the terrain, even beyond camera far plane, or scale down the plane. The first flight simulator I have seen was GunShip for Comodore 64. A “hill”, one mile by one mile, has been a pyramid made of 5 vertices! And I don’t know if I ever spent so much time playing a single game like I did with GunShip. And the sky-dome, well, keep it small (as big as your visibility distance), and move it together with the plane or camera (in horizontal direction, but not vertical). Of course your terrain will look a bit simple, but you can do any size of terrain if you keep detail low.

The problems start when you want to have high detail AND large terrain. And you are pretty much on your own from now on, afaik.

First, you won’t be able to keep all your terrain data in memory (a few hundred megabytes or some gigabytes), so you have to load and unload parts of your terrain while you fly around. Out-of-core and paging are the words to search for.

Since a flight simulator doesn’t need unique terrain details you could also procedurally generate some “detail” information for your low-resolution terrain data (perlin noise, detail textures, …).

Then, perhaps, you want to save a few vertices and render distant terrain chunks at lower resolution than the terrain directly below you. So you have to decide for a way to do LOD. Geo-mipmaps is the best I know at the moment, but there are a dozen more.

Then you want to optimize even more, and consider the camera frustum and perhaps hide parts of the terrain which are not visible from the current position, perhaps a valley behind a mountain (potentially visible sets, offline calculated).

Oh, and huge terrain doesn’t only mean huge landscape, but also huge numbers of trees, vegetation, buildings, mobile objects and so on. You have to load/unload these objects too (and perhaps activate/deactivate, if there is logic tied to the 3d models). So perhaps it is possible to design your game code with this in mind, and load/unload terrain chunks TOGETHER with the objects on this chunk in one go, at the right level of detail.

And finally popping, well, I have read that hardware geomorphing (in GPU) is a good way to avoid popping. Lighting can hide the effects of popping, and you don’t need normals/binormals/tangents stored together with mesh data. For example a normal-map (bitmap, with vector coordinates stored in r/g/b channels) will do too, and can be created offline using the highest possible resolution of your terrain.

So, after being mean here is my real advice: Lean back and think about your requirements. What terrain features do you really need? What are your resources (hand-modeling huge terrain will cost you more time and money than Betheda had on their Oblivion budget). There is no solution that suits every project.

Hope this helps
enn0x

check out the soarx post somewhere on the forum. soar is pertty much perfect for flight sims, you can have hundret of miles viewing distance while beeing able to keep the ground VERY detailed.
check out https://discourse.panda3d.org/viewtopic.php?t=2265&highlight=soarx
and dont miss the orignial side of the algorithm http://web.interware.hu/bandi/ranger.html
popping depends on the detail settings but usualy its minimal to not visible. if you use a simple bumpmap on the terrain you can greatly improve the detail-richness. but even without it its already quite awsome. check the demovideo on the rangermkII page :slight_smile: i think the one with 10mb size is most impressive :slight_smile:

well paging the whole thing is a bit tricky but you could puzzle together your heigfield in a offscreen buffer and make a new texture from it. if you feed the soarx with this data you should be able to make quite awsome terrains with impressive size.

and for the skydome. you can use a pretty small model, lets say about the size of your airplane, reparent it to the camera and set its render order so that it’ll always be in the background =). the spaceshooter example here in the forum does the same.

oh and in case you need collision detection (with the groud) i recomment you either build a second mini-terrain with just the size of your airplane (and always update it so this mini-terrain is always the “true” terrain below the plane). or you set up a collision plane which divides the world-space in half and get the coordinates and direction of it from the raw terrain-data (at the point below the airplane).

nothing’s impossible =)

greetings
thomasegi

Thanks!

Thomas. I only scanned that page on SOARX. But what did catch my eye was that it only works with nivida GPUs. Is that correct. OR is that just the demos?

Yes and no.

The algorithm creating the terrain mesh each frame doesn’t require a particular graphics card. But the demo uses special effects to shade (texture, shader) the terrain surface.

The Panda3d wrapper is the same. The terrain is created with CPU power, which is a major drawback in my eyes. And it uses a simple demo shader to apply a texture and some lighting based on a gradient map and a bump map. But using this shader is for demonstration purposes only. You can do whatever you want to shade the terrain.

By the way: the Panda3d wrapper is updated now.

enn0x