Multiple vertex arrays

Started by
11 comments, last by edotorpedo 21 years, 1 month ago
Hi, I''m working on a terrain-engine (GeoMM + quadtree), and I was wondering how to use vertex arrays with this. I traverse a quad-tree, and at each leaf I render the vertices. Would I need one big vertex arrays with an index array for each leaf, or is it possible to create multiple vertex arrays for each leaf. How would I do this? Thanks, Edo
Edo
Advertisement
The possible ways of doing it:

a) One VB and IB for each node in your tree.
Simple to Implement, but not optimal.

b) One VB + n IB''s: as many IB''s as you can depending on what the hardware can achieve, e.g. until the vertex buffer is full ( some cards can do 32 bit index buffer, others only do 16 bit. )

Not as simple to implement as (a), but making optimal use of VB''s and IBs

I have not verified what the performance impact is between (a) and (b), so I''m not sure if the extra effort is worth it to implement (b).

Hope this helps.
<$1,000,000 signature goes here>
Unique VB for each terrain tile, and one IB for all of them (if they are regular of course). If the number of vertices in the VB is large enough then there is really no impact in switching VBs (especially if they have same FVF).

OK, I think I will go for one VB at each leaf and n IB''s at each leaf (because I need to render leaves at different LOD).

But something still isn''t clear. How can you switch between two (or n) VB''s? You all load them using glVertexPointer, and this doesn''t return a pointer to this particular array, which you can use in glDrawElements().

How would one go about implementing this: do I need to call glVertexPointer for each leaf for each frame?

Thanks,

Edo

Edo

BTW: Has anyone tested what the most efficient way of solving cracks is? (there was a thread on this a couple of threads back)

Edo
Edo
If you have a regular grid for you terrain, you only need one IB for each level of detail, not n IB for each leaf. If you think about it, all of the leaves would end up with the same set of n IBs.

Karg

But I don''t have a regular grid. I''m using GeoMipMapping, so I need an IB for each LOD-level of my leaf. I also need an Vertex Array for each leaf. But I still can''t figure how I can create more than one vertex array, without switching VA each frame. I just don''t get it, the only way of setting another VA is glVertexPointer, isn''t it ?? But I don''t feel like calling this 256 times each frame.

How can I do this.

Thanks,

Edo
Edo
GeoMM is typically performed using a VB for each leaf but only n IBs for each LOD. The IBs are regular and don''t take account for the specific geometry in each leaf (that''s done using the rough error metric).

You could use an IB for each leaf but you''d probably still need regular edge meshing so you don''t get any cracks. Or you could use some alternative solution like edge skirts.
Doz


You''re right Doz, I only need n IB''s for each LOD, not for each leaf. This will need some serious pointer work, because I need to access these IB''s at a leaf of my QuadTree. However, this will not be too much of a problem.

Does anyone accidently know the answer to my second problem (creating multiple vertex arrays), or maybe point me to an implementation?

Thanks for the replies so far,

Edo
Edo
quote:Original post by edotorpedo

You''re right Doz, I only need n IB''s for each LOD, not for each leaf. This will need some serious pointer work, because I need to access these IB''s at a leaf of my QuadTree. However, this will not be too much of a problem.

Does anyone accidently know the answer to my second problem (creating multiple vertex arrays), or maybe point me to an implementation?

Thanks for the replies so far,

Edo


If you have single VB per patch, you can live with only one IB.
And besides geomorphing, just unite four patches when they change LOD to greater into single one with same number of vertices.

This topic is closed to new replies.

Advertisement