# OpenGL rendering distant terrain

## Recommended Posts

i'm creating a flight simulator type game and i'm rendering a terrain using a 512*512 heightmap and 'wrapping' the terrain as the end of the map comes into view. while probably not important, this is being done in opengl. the effect i'm after is the ability to fly around a mountainous area and be able to see the valley's and other mountains in the distance. the problem is that the mountains and the rest of the terrain look as though they are being built up brick by brick as they come into view. as you can imagine, this issue worsens as the plane's elevation increases and the edges of the landscape come into view. it's like flying over a big square island.. i've done a lot of searching for info about this, and found quite a bit, but most of it over my head or quite dated. The one technique i saw that stood out more that others was Chunked LOD. is this still the preferred method? i'm quite new to all this, so if i'm going to learn something, i'd like to make sure first i'm heading down the right path.

##### Share on other sites
I once found a Word document from Microsoft describing some details of how this is done in the MS Flight Sims. There they use a terrain LOD algorithm mapping the terrain onto a sphere since the spherical shape does matter when viewing terrain from high above.

In the end it does not matter that much what kind of modern LOD algorithm you employ. The important part is to have a spherical terrain to prevent this rectangle pop-in artifact. You basically render half a planet so there is no popping at all because the natural horizont limits the view. The trick is to keep the patches simplified enough to be able to render this half sphere fast enough with a good enough resolution. Maybe googling for "spherical terrain" in combination with "lod algorithms" reveals more information useful for you.

PS: The first hit on this Google search is the MS document.

##### Share on other sites
simply creating a paging landscape and set your camera far plane so that the newly created terrain patches are out of the view. when you fly they will come into view. If you want to view a huge landscape then geoclipmapping or quadtree clod landscapes is what you want.

##### Share on other sites

Good index site of Terrain rendering techniques.
www.vterrain.org

And if you want to use something special,
you could try using fullscreen skycubemap imposters
around camera. (3-6 levels of cubes for distant
terrain gives good parallax effect with low update frequency)

/Tyrian

##### Share on other sites
Although LOD techniques like geoclipmapping are ultimately what you'll want to use it sounds like your immediate problem is just to do with setting your clipping planes correctly. A standard method to deal with this is to break the terrain into chunks and render the chunks in order sorted by depth, with the near and far clip planes set independently for each chunk to more-or-less tightly bound them. I hear logarithmic z-buffers are useful too, but I've never tried this myself.

##### Share on other sites
Quote:
 Original post by Emergent... it sounds like your immediate problem is just to do with setting your clipping planes correctly

I would say that this is part of the problem but no matter how you set your clipping planes: When viewed from high above the ground (we are talking about thousands of feet) a flat terrain will suffer this problem. THe horizont will never look okay for a flight sim, hence the suggestion to look into spherical terrains and use standard LOD algorithms on half a sphere. [smile]

##### Share on other sites
Quote:
 Original post by WaterwalkerI would say that this is part of the problem but no matter how you set your clipping planes: When viewed from high above the ground (we are talking about thousands of feet) a flat terrain will suffer this problem. THe horizont will never look okay for a flight sim, hence the suggestion to look into spherical terrains and use standard LOD algorithms on half a sphere. [smile]

I 100% agree.

##### Share on other sites
I may be wrong but every time I've been in a plane, I don't notice the curvature of the earth. You would have to be above 50,000 ft. maybe to notice it?

I honestly think the main issue is scale and clip planes. Take a GIS gtopo30 heightmap of the Himalayas and stick it on your landscape. The top of the highest peak is somewhere around 36,000 ft.

Unless your flight sim goes into the upper stratusphere there isn't a need to do spherical terrain unless you want to take a few hours to zoom around the world.

Even MS Flight Sim (with it's spherical terrain) you don't notice the curvature until you hit the upper canopy of the atmosphere.

I believe getting scale for the landscape chunks right and getting a good balance of the clip planes will suffice.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627665
• Total Posts
2978523
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 10
• 10
• 12
• 22
• 13