I've been thinking about this for a while and I am kinda getting to the "code something and see if it bloody works" stage, but I want to have a chat about it with youguys first.

The problem I am trying to get my head around is the shear scale of things. I've written planetary terrain systems in the past, but they don't require that Buckingham Palace is recognisable and in the correct place.

Say I want to be able to have a theatre of operation that covers western Europe in the 1940's. Your are looking at about 1000 miles by a 1000 miles.

That's a big area. Using a 4K texture gives me a resolution of about 0.25 miles per pixel. Not very nice.

So I started thinking about using the texture pixel as the base height and adding in pseudo random noise for detail. In effect turning every pixel into a CLOD (well I'm leaning towards ROAM) patch.

Then I can have the resolution I want at the cost of a lot more processing, but at first glance it looks possible.

The next thing I thought about was visibility. If I was at ground level, then it's not too bad. Maybe an 8 by 8 set of patches would suffice.

However at 35,000 feet. The visible range is huge and I'm having to handle huge numbers of patches. Admittedly all of them would be reduced to a single quad, or at least most of them, but it's still a lot of patches.

So I started thinking about organising sets of patches into region patches, and groups of region patches into sector patches, and sector patches into country patches, and about that point I decided to go for a beer instead.

Create a quad tree for your terrain. Make each leaf contain a mesh fixed size such as 33x33 vertices (you can even use tesselation hardware for this). Subdive the quadtree nodes based on the distance from camera, for example : if camera distance to node bound is smaller than the bound size, subdivide (this may not be optimal algorithm).

WIth few hundred quad tree nodes you'll be able to simulate pretty huge terrains at variable resolution. Increasing the visible range gets cheaper and cheaper since bigger nodes cover bigger terrain areas. Of course you should try to keep the terrain triangles small enough so that the screen space error is small. This can be handled with a proper node subdivision algorithm.

In the best case you'll have a height texture or texture array which contains 33x33 blocks.With a 1K x 1K height texture, you can have around 900 nodes in the GPU memory in the same time. When the camera moves, you'll need to update the height texture from system ram, or hard disk, or use any random terrain algorithm you find suitable.

35,000 feet ... in the 1940's. Your are looking at about 1000 miles by a 1000 miles

35,000 feet? Spacecraft in the 40s? You might consider revising your parameters before you design everything. A P15 Mustang had a maximum altitude ~10,000 feet. So maybe more like 125x125 miles. You can limit that even further by adding haze (fog/clouds) as, at high altitudes there wouldn't be a real use for a pilot to see more than (maybe) 10 miles.

EDIT: Oops. Misread some info. This post is bogus.

Edited by Buckeye, 18 August 2014 - 03:32 PM.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

35,000 feet ... in the 1940's. Your are looking at about 1000 miles by a 1000 miles

35,000 feet? Spacecraft in the 40s? You might consider revising your parameters before you design everything. A P15 Mustang had a maximum altitude ~10,000 feet. So maybe more like 125x125 miles. You can limit that even further by adding haze (fog/clouds) as, at high altitudes there wouldn't be a real use for a pilot to see more than (maybe) 10 miles.

The Me-262 had a service ceiling of 37,565 ft, and the P51 Mustang had a service ceiling of 41,900 ft.... what are you talking about?

I had to write something like this in my first job, it was about WinXP times, with ~128MB ram and GPUs with 4MB-32MB, artist drew a map of about 16384*12288+mips in DXT3 which was quite a chunk of a CD.

My pragmatic way to solve it was to divide the map into a simple Grid, every Grid entry with tiles of 256x256 which led to 64x48 for maintainance, which really isn't much to worry about (that's why I didn't go for quadtree or something). The grid entry was a struct, having the offset of the zipped texture in the archive, a 2d distance to the player and a pointer for the device texture.

depending on your hardware (or rather your settings), there were some 256x256 textures allocated, some 128x128, and most 64x64. On initialization, the distance to the player was calculated for every grid entry, then those 3k cells were sorted and initialized the textures by picking the highest available.

every frame the distance was re-evaluated and an iterator was increased, doing like a simple bubble-sort pass.the iteration was interrupted for the frame either if the interator looped through all grid entries or if two entries with a different texture resolution needed to be swapped. in that case the pointers were swapped and the textures were uploaded (that way there was no dynamic allocation fragmenting the GPU mem and the framerate was quite stable as the amount of uploads was limited). At that time there was no multicore (maybe there was a Pentium D already, dunno), everything had to run single thread so there was no smart streaming going on. The map archive was installed on HDD, it was read only memorymapped by windows, but access could still stall and drop a frame or two.

Yet in general it was running quite smooth. I could imagin you could nowadays go to 4096x4096 tiles, if DXT+zip is not enough, even transcode those from jpg to have more space -> more tiles on disc. that would be 262144x196608 pixel ;)

(btw. I had no heightmap, just flat terrain, but you could get it working with CLOD terrain I if the border of your Grid entries meet, that would barely reduce the resolution.)