Sign in to follow this  
ndhb

OpenGL Large terrain with support for run-time modifications

Recommended Posts

I just post to share some work with terrain rendering that I did for a university project. The project was about how to render very large terrains and still be able to make modifications to the terrain surface (erosion, explosions, etc.). The approach I came up with is based on the Clipmap Texture. The implementation was written OpenGL and Java and uses Shader Model 4 features (texture arrays, vertex texture fetch with a non-32f texture format). I used the 16385 x 16385 dataset from Puget Sound found here. The terrain is not textured because I wasn't able find a detailed aerial photograph of the area, but there is diffuse lighting. Here are two screenshots in which I added some bump-mapping noise. Flying above Mt. Rainier Looking towards Mt. Rainier Another screenshot uses a single dirt texture repeated across the surface modulated with noise. Computing procedural textures is something I would like to work on in the future. There are other screenshots in my paper. The paper also describes the approach in detail. Although the world probably doesn't need another terrain render algorithm, maybe someone can use this for something. I anyone has any comments or questions, I will try to explain or answer. I have uploaded a video of the runtime modifications to the terrain (it's compressed with www.xvid.org codec). There's also a video of the incremental updates as the detail center is moved around [Edited by - ndhb on November 17, 2008 8:39:32 PM]

Edited by ndhb

Share this post


Link to post
Share on other sites
Looks nice :)

Im looking into terrain rendering myself but deformation/modification isnt really on my list. However i do want to use authentic GIS/Bathymetric data for the terrain map.

Share this post


Link to post
Share on other sites
Congrats on the nice paper you have written there, especially a lot of good background information.

Re your method for avoiding T-junctions, the end result seems similar to that used in the Infinite Universe Engine (PDF). They restrict neighbouring tiles to differ by at most 1 level of detail, and pre-calculate the 16 unique index buffers, and use them based on the level of adjacent tiles. This results in a similar mesh configuration, but avoids the degenerate triangles and some complexity in the vertex shader.

Share this post


Link to post
Share on other sites
Thanks Barking_Mad and Swiftcoder.

Quote:
They restrict neighbouring tiles to differ by at most 1 level of detail, and pre-calculate the 16 unique index buffers...


I just read the paper you linked to. I liked that the author points out the problems with cascading split/merge operations on the bintree. These are a serious concern when handling very large datasets with these CLOD algorithms (e.g. ROAM). Clearly this issue only becomes even more serious when the terrain can be modified (!) and it deterred me from pursuing a CPU based algorithm.

Yes, pre-computing different index buffers and binding them to the VBO as dictated by neighbouring levels, would also avoid these tile-transitions. Whether rebinding the index buffers (API function call overhead) or evaluating the instructions in the vertex shader (shader overhead) is faster, I can't really say without experimentation - I guess it largely depends on the number of patches/draw calls to cover the terrain is satisfactory detail.

Share this post


Link to post
Share on other sites
Quote:
Original post by ndhb
Quote:
They restrict neighbouring tiles to differ by at most 1 level of detail, and pre-calculate the 16 unique index buffers...
Yes, pre-computing different index buffers and binding them to the VBO as dictated by neighbouring levels, would also avoid these tile-transitions. Whether rebinding the index buffers (API function call overhead) or evaluating the instructions in the vertex shader (shader overhead) is faster, I can't really say without experimentation - I guess it largely depends on the number of patches/draw calls to cover the terrain is satisfactory detail.
I avoided the binding cost by placing all 16 index sets in a single buffer, and using different index ranges depending on the neighbour configuration.

Share this post


Link to post
Share on other sites
Quote:
I avoided the binding cost by placing all 16 index sets in a single buffer, and using different index ranges depending on the neighbour configuration.


Clever. I will try and play around with that idea when I find time for it :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Partner Spotlight

  • Forum Statistics

    • Total Topics
      627644
    • Total Posts
      2978367
  • Similar Content

    • 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.
      Thank you in advance!
    • 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?
       
    • By test opty
      Hello all,
       
      On my Windows 7 x64 machine I wrote the code below on VS 2017 and ran it.
      #include <glad/glad.h>  #include <GLFW/glfw3.h> #include <std_lib_facilities_4.h> using namespace std; void framebuffer_size_callback(GLFWwindow* window , int width, int height) {     glViewport(0, 0, width, height); } //****************************** void processInput(GLFWwindow* window) {     if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)         glfwSetWindowShouldClose(window, true); } //********************************* int main() {     glfwInit();     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);     glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);     //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);     GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", nullptr, nullptr);     if (window == nullptr)     {         cout << "Failed to create GLFW window" << endl;         glfwTerminate();         return -1;     }     glfwMakeContextCurrent(window);     if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))     {         cout << "Failed to initialize GLAD" << endl;         return -1;     }     glViewport(0, 0, 600, 480);     glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);     glClearColor(0.2f, 0.3f, 0.3f, 1.0f);     glClear(GL_COLOR_BUFFER_BIT);     while (!glfwWindowShouldClose(window))     {         processInput(window);         glfwSwapBuffers(window);         glfwPollEvents();     }     glfwTerminate();     return 0; }  
      The result should be a fixed dark green-blueish color as the end of here. But the color of my window turns from black to green-blueish repeatedly in high speed! I thought it might be a problem with my Graphics card driver but I've updated it and it's: NVIDIA GeForce GTX 750 Ti.
      What is the problem and how to solve it please?
  • Popular Now