Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Terrain Editing - once again

  1. #1

    Terrain Editing - once again

    System: Windows XP, Pentium D 805 2,8 GHz, GeForce 7600 GS
    Compiler/IDE: Delphi 2005 for Win32
    API: OpenGL
    ---

    Hello :!:

    I've written a post before, but it has been deleted due to breaking the rules. This time it should not happen again.

    But to the point. Together with my group we've decided to make a terrain editor for our game. I got stuck with the editor, because I don't really know how to optimize the rendering of it. When I use heightmap which is 64x64, everything works fine and the framerate is pretty decent. When the heightmap is 512x512, the framerate goes down drastically.

    Have you got any ideas :?: It'd be nice if you sent me some code. If you want, I can send you my code. I have nothing to hide from you.

    Regards :!:

  2. #2

    Terrain Editing - once again

    First, how are you rendering the terrain ? Using intermediate mode or vertex arrays ? The latter are alot faster. (Terrains of 512x512 are no big deal in a editor and current hardware)

    Secondly to optimize it further look up geometrical mipmapping, forget everything about ROAM and similar technices, todays gpu's is fast enough to use the easier geomipmaps.

    http://wiki.delphigl.com/index.php/G...cal_Mipmapping

    And as a third thing, use frustrum culling on the terrain chunks to only render what's visible
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  3. #3

    Terrain Editing - once again

    This is the code I use:
    http://www.glsoftworks.pastebin.com/f29375c3d

    Can you help me out now?

  4. #4

    Terrain Editing - once again

    Quote Originally Posted by Brainer
    This is the code I use:
    http://www.glsoftworks.pastebin.com/f29375c3d

    Can you help me out now?
    What do you want help with? You asked for ideas of how to improve the speed of the terrain rendering. Doesnt geomipmaps help ? Or the frustrum culling ?

    I saw in your source that you where using vertex buffers, that's good. But just a node, drop the displaylists, they just dont gonna do it.

    However it seems strange that you're experiensing fps problems with no larger then 512x512 terrain.

    Found the doc that i used when writing my terrain renderer; http://www.flipcode.com/articles/article_geomipmaps.pdf
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  5. #5

    Terrain Editing - once again

    Seeing the code, this is the only render call i found:

    glDrawElements(GL_TRIANGLE_STRIP, FIndices.Count, GL_UNSIGNED_INT, FIndices.List);

    So it is no wonder it gets slow... You couldn't edit world like 2000x2000 with system like this, view must be restricted some way.

  6. #6

    Terrain Editing - once again

    Found the doc that i used when writing my terrain renderer; http://www.flipcode.com/articles/article_geomipmaps.pdf
    Man, what is that? I can't understand even a word. :roll:

    Seeing the code, this is the only render call i found:

    glDrawElements(GL_TRIANGLE_STRIP, FIndices.Count, GL_UNSIGNED_INT, FIndices.List);

    So it is no wonder it gets slow... You couldn't edit world like 2000x2000 with system like this, view must be restricted some way.
    You mean using f.i. octree? I've seen somewhere few Delphi implementations. Maybe I should try it? What do you think?

  7. #7

    Terrain Editing - once again

    Checked wiki Quadtree might be good way with possibly frustum culling... Quadtree would simply mean dividing the map in many small maps, where frustum culling would tell which of the small maps are visible. Still trying to avoid too many frustum checks or it lose its purpose (speed). Because of heightmap i would make frustum checks 2 dimensional if at all (if camera is always top-view there's no need for frustum).

    I only learned more about vertex arrays little while ago so haven't tried making this all that optimal, but i would imagine this needing several dynamic vertex arrays.

  8. #8

    Terrain Editing - once again

    I have figured out another way of doing it. I dunno it's the correct one, but I think it's good to let you know more about it.

    Suppose I've got a heightmap, which dimensions are 512x512. Rendering goes very well when the heightmap is 64x64, so I could divide my heightmap into eight smaller parts (64x64 each). Then I could calculate a bounding box for each parts and check whether the cursor is inside or not. If it's outside, I'll use a display list. Otherwise, I'll disable the display list and render the geometry without it. Do you get what I mean? What do you think of that idea?

  9. #9

    Terrain Editing - once again

    That's close to quadtree approach, still, if part of map is not on the screen it shouldn't be rendered at all even if it's a displaylist. My tests ( http://www.pascalgamedevelopment.com...pic.php?t=4785 ) rendered vertexarray faster than displaylist but that's thing to be experimented if you like, i could be wrong

    VBO's might speed it up too for you but it's taken from same memory that textures use, becoming more hardware dependant so not my favorite...

  10. #10

    Terrain Editing - once again

    Thanks for useful hints. I'm going to write some code now using your and mine ideas. I'll let you know later about the result - I'll post the code then.

    .: EDIT !! :.
    I did some changes, but I don't know why my "favorite" error occurs (line 26. :?
    http://www.glsoftworks.pastebin.com/f5051d109

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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