Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31

Thread: Rendering Large Terrain

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    12

    Rendering Large Terrain

    Hello all!

    I am trying to render a large terrain in OpenGL. My terrain consists of multiple terrain blocks of size 1000x1000 meters (1001x1001 vertices).
    Each block consist of multiple driangle strips drawn by means of the glMultiDrawElements(GL_TRIANGLE_STRIP, ...) function.
    But when I for example create a terrain of size 6x6 kilometers (6x6 blocks) I get a poor performance (only about 2fps).

    How could I improve It? Can I use triangle strips or should I use another primitive type if I want to use a LOD technique?
    Is there a simple terrain LOD tutorial for beginers with a simple code samples which explains it step by step?
    All tutorials I have found were too much theoretical or were very complex and complicated for learning.

    Could you please help me?

    Thanks so much

    -Martin

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    28
    What OpenGL version and graphic card are you using?
    Could you show us how are you drawing that meshes?

    Edit: Triangle strips are (usually) one of the fastest modes so there's no problem with that.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    12
    I am using Nvidia GeForce gt555m (notebook) with OpenGL 4x, but I like to preserve compatibility with OpenGL 3x.
    The terrain meshes are drawn by means of the glMultiDrawElements function, i. e. terrain of the size for example 1x1 km consists of 1000 triangle strips of width 1m and length of 1 km.
    The vertices are stored in an float array of size 1000x1000x3. The first triangle strip has indices 0, 1000, 1, 1001... The second strip has indices 1000, 2000, 1001, 2001... etc...

    I would like to use a LOD technique because I think that drawing a large terrain without LOD is too clumsy. But I don't know where to start...

  4. #4
    Intern Contributor Brokenmind's Avatar
    Join Date
    Feb 2014
    Location
    Aachen / Germany
    Posts
    71
    • Save your height vertices in a height map
    • Save a terrain block (chunk) as a VBO (preferrably much smaller than yours, 32x32 has proven to be good)
    • Write a drawing function: Define what to draw and how detailed to draw it based on the distance to the camera
    • Draw it instanced (all the necessary information for each chunk can be stored in 4 floats)


    An old image of mine displaying the precision of the chunks can be found here.

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    12
    Okay, so I should learn instanced rendering first. I have never did it...

  6. #6
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,146
    Not necessarily. Most terrain rendering algorithms don't use instancing. I prefer clipmaps.
    Take a look at vterrain.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    If you're able to leverage tessellation, this approach is also noteworthy. Or this.

  8. #8
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,146
    Tessellation shader approach is not superior to vertex shader approach because of at least two reasons: VS has wider support and there is no limitation on the size of the blocks.

  9. #9
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    Aleksandar: I didn't say it was superior or the only way - I just proposed it as another contemporary alternative. It's definitely better than ROAMing.

  10. #10
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,146
    Sorry, I didn't want to offend you.
    Definitely better! ROAM is a prehistoric algorithm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •