Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423609

Whee, terrain

Sign in to follow this  
Evil Steve

199 views

I thought I'd have a play with some terrain for a change, since I haven't done one before. Well, I tried, but they were really crap.
My terrain at the moment can cope with a 512x512 heightmap quite comfortably (~40 FPS when rendering the whole thing - about 500k triangles), and a 256x256 terrain runs nice and smoothly.
I take all of the height values, and break them into 33x33 vertex chunks. I cull the chunks against the viewing frustum, so I don't render chunks that aren't visible.
I have several vertex buffers of up to 65536 vertices, and one dynamic index buffer. Each frame, I loop through all of my terrain chunks, and if it's visible, I get it to draw itself into the index buffer.
That works fairly well, but I'm still rendering high resolution chunks if they're miles away from the camera. I'm probably going to use geomipmapping, or something similar, since I have Game Programming Gems 3, which has a gem on it (or is it GPG2? I don't know, I have 1-4 anyway) and it seems fairly easy to get to grips with.

Anyway, here - have some screenies:
256x256 terrain 512x512 terrain
Now I'm off to try and optimize it a bit...
Sign in to follow this  


8 Comments


Recommended Comments

Looking good! If you're interested, and haven't seen it before, I believe the original paper describing GeoMipmapping was posted here.

Share this comment


Link to comment
I just implemented the one in Gems 2 by Greg Snook. Really easy to implement (its DirectX, but you said you were using DirectX anyway, right?)

Share this comment


Link to comment
Yup, that's the gem I was talking about. From what I remember, the only thing I didn't like about it is that you need a craload of index buffers, and switching between them is fairly expensive, and means more DrawIndexedPrimitive calls, which are also fairly expensive.
I'll have to re-read that gem before I get my LOD stuff actually coded up.

Share this comment


Link to comment
Well, the index buffers are already created, so all you actually do is create a bunch of vertex buffers and draw using the index buffer based on left, top, bottom, and right sides, then draw the center.

Check the code on the CD. Its pretty clear. I just printed it, read it once through, and got it. The only partially confusing part is the creating Detail Tiles.

Share this comment


Link to comment
=Terrain.exe 0 Errors, 0 Warnings=
*GnaAHHhhhhh!*

ROFL

Share this comment


Link to comment

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
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!