Author Topic:   Probably one of the simpler (dumber) terrain questions...
posted January 10, 2001 01:50 PM            
Hi folks,
My first post! I've read through a lot of the site though

Ok, here is the deal:
I'm trying to render a CLOD terrain using Quadtrees. Now, for all intents and purposes it doesn't even have to be a CLOD! All I want is to generate a terrain based on a heightmap but using Quadtrees.

This is what I've got so far...
I'm able to read the RAW file, get the height values (based on color) and then automatically generate 1 vertex buffer, filled with all the terrain vertices (1 vertex per pixel, is that right?) and then another index buffer which is arranged so that the rendering is done with Triangle Fans. I'm using DirectX8 btw!
Now, here is the bit of the problem:
I finally understood what exactly quadtrees were, in theory, thanks to the messages on this board, but here is what I don't get... what does the quadtree have anything to do with my vertex/index buffer? do I store a seperate vertex/index buffer per tree node/leaf? I guess the question is how do vertices get generated or stored in a quadtree? Are they generated once and then rendered each frame or do I have to regenerate all my vertices again? Also, since I'm using Triangle fans in DX8, the vertices have to be clockwise (I assume it's the same as OGL).

Sorry for the mess of a question... I don't quite understand what I'm doing
Thanks very much for any help you can provide! Source or other useful links would be appreciated... I don't mind reading on them if I knew where to look!


posted January 10, 2001 04:08 PM         
Unfortunately, I don't know a thing about CLOD, LOD, or any level of
detail algorithm. I try to stay away from them as far as possible for
now. But this might be a good place to start:

As for vertex buffers, if you're rendering strips or lists, you could
possibly create one huge buffer and copy all your vertices over to it
and just call it once every frame. But if you use fans, you can't do
this, because fans simply don't batch up. Fans have to be rendered
separately, unless you convert them into strips or lists first. I
personally don't use strips or lists, so I don't know how much of a
performance difference this makes.


posted January 10, 2001 05:30 PM         
One more thing:

If you want to draw your vertices as fast as possible, you have
to understand how your 3D card works natively at the hardware level.

For example, if your card natively works with indexed strips, then
you should send it indexed strips. If you send it fans, then it
must perform some kind of conversion from fans into indexed strips
before it can process them.

But, how do you even know how your card works optimally? I have never
come across a chart or listing of how various 3D cards work natively,
so I know very little. Different cards can work differently on
data, so I wouldn't assume one way is the best for all of them.

In another thread, someone mentioned here that GeForce/GeForce2 likes
indexed strips. But how many vertices you can optimally send it,
I don't know.


posted January 10, 2001 06:01 PM            
Hi Lith,
thanks for the response. I've read a few of your posts. I think we're on the same page as far as the terrain goes. My question is not about LOD actually. For now, I don't even want LOD. All I need to know is basically how a QuadTree works. I understand what it is, in theory, but in practice I don't see how the nodes relate to actual vertices. OR how vertices are stored at each node or even how it generates the vertices at each point from the heightmap.

I know how this works without a QuadTree, but I basically can't "see" how a QuadTree ties in with this whole thing...

Any info I can read up on? The best thing would be sample D3D code, but I understand a lot of people here use OGL(?).

OH! btw, I'm using a TNT2 card, so I'll have to find out what type of primitive works best with that....

Thanks again!

[This message has been edited by binaryz (edited January 10, 2001).]


posted January 10, 2001 09:55 PM         
Nodes as I use them are basically triangle fans. If you know
how to draw a triangle fan, then you know how to draw a node:

A simple triangle fan node has 6 vertices:


5,1 are at the same vertex and 0 is your center vertex. They
are draw CW.

Every point on your heightmap is a vertex, so if you draw
a 5x5 heightmap on paper, and split it up into 2x2 blocks (your nodes)
you will have exactly 4 nodes for your 5x5 heightmap:


o is the center vertex for each of the nodes.

I hope this is easy to understand.


posted January 11, 2001 08:05 AM            

Got it! I knew the h-map was mapped to 1 vertex per pixel, I just couldn't see what the nodes had to do with that... cool...
Thanks again for the help Lith

Pretty quite on this board other then us two eh?


Dreamer (BWL/MG)
posted January 11, 2001 08:18 AM            
On this topic, you mean...
Observe the number of posts per month on the TreadMarks General topic and you'll be amazed.


posted January 11, 2001 09:34 AM            
Hey Dream,
Will do... didn't even notice the other topics