• Advertisement

Archived

This topic is now archived and is closed to further replies.

A few questions

This topic is 5358 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so I now know how to work with vertex buffers, vertex indices, etc...I can draw some crap(im talking about putting in the vertex data in code, which sucks)... Now, how can I put everything together to get a full, structured world? I mean, I dont really want to build terrain in 3DS Max or other modelling programs (nor by putting vertex data in code, obviously), so, do I create a heightmap and render terrain based on that? I dont know how to use a heightmap...I assume that you create a vertex for each pixel, and the height of the vertex is based on the color, right? After I have all my terrain, how do I actually put it into something to figure out what needs to be rendered(quadtree, bsp?(thats what its used for, right?), etc)? Ive looked at some of the articles on this site, but, I dont really get it...I might understand alot of the theory...but putting it into practice gets me Hmm..thanks for reading all my questions...if anyone has any information that might help me, I would greatly appreciate it! Lord Hen =)

Share this post


Link to post
Share on other sites
Advertisement
Take it step by step is my sugegstion. Don't worry about Quadtrees and BSP's for the moment. Try to create a brute force terrain renderer.

A terrain renderer uses heightmaps. These can be created in any paint program and is usually stored as a greyscale 8-bit RAW image (meaning: every pixel is described by only one value ranging from 0 up to 255). Next, you read the image in an array in your app. Each value in the array holds the height for that point (you might want to multiply all the values by a small number to smoothen the terrain a bit. Try 0.1f).

After that you simply render a grid on the X-Z plane and use the heightmap array for the Y values. So for a 4x4 raw image you would use the following grid:

*---*---*---*
| /| /| /|
| / | / | / |
|/ |/ |/ |
*---*---*---*
| /| /| /|
| / | / | / |
|/ |/ |/ |
*---*---*---*
| /| /| /|
| / | / | / |
|/ |/ |/ |
*---*---*---*

Once you have got this running it is time to worry about quadtrees and other optimization techniques.

EDIT: Forgot the code tags

Sander Maréchal
[Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]


GSACP: GameDev Society Against Crap Posting
To join: Put these lines in your signature and don't post crap!

[edited by - sander on August 18, 2003 2:14:29 PM]

Share this post


Link to post
Share on other sites

  • Advertisement