#### Archived

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

# primitives for ground?

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

## Recommended Posts

Im trying to figure out a nice way of rendering ground. How do you usually do that? The only way I can think of is doing it row-by-row. I'll try to do some ASCII-art:
------------------------
\  /\  /\  /\  /\  /\  /
\/  \/  \/  \/  \/  \/
-----------------X----
/\  /\  /\  /\  /\  /\
/  \/  \/  \/  \/  \/  \
-------X----------------
\  /\  /\  /\  /\  /\  /
\/  \/  \/  \/  \/  \/
-----------------------

This means though that you'll have several vertices on the same worldposition (Marked with X on two spots). You'd render the rows like this:

--------->--------->----------+
|
+----<---------------<------+
|
+----->------------>--------+
|
<------------<-----------+

Im thinking of "wavey" ground, like in Motocross Madness. Anyone know of a special way to render open areas? [edited by - Enselic on January 31, 2003 6:19:10 PM]

##### Share on other sites
Planning on ground hm... Well here''s what little I can safely advise on:

Learn to cut up a large terrain into smaller football-court (or smaller) sized ''patches'' for the day when you''ll load and unload some of these ''patches'' because the whole big terrain became too large for RAM memory.

It''s okay if vertexes are shared, that''s a cue for one to use index buffers along with the vertex buffer. Those are actually faster in certain circumstances. (Source: NVidia)

About your ''see-sawing'' approach, I''m not sure you''ll manage to make the little vertical step and carry on with a trianglestrip, I remember trying and failing once. However if you can make it, great! This see-saw approach with an index buffer will mean that the ''return trip'' will reuse some vertexes that are likely in the vertex cache on a Video card. (A certain cache that maybe contains just 10-20 vertexes or so)

I think you could make a whole grid of triangles with your see-saw approach by usinging a degenerate triangle or two at the end of each line. Seems like an okay sacrifice to make since the entire grid could be tossed in a single trianglestrip DrawPrimitive call! (This is purely an experiment I''m thinking of... But it''d go like this)

1-2-3
|/|/|
4-5-6
|\|\|
7-8-9

Test #1:
TriangleStrip would start with 1-4-2, then follows normally with 5, 3, 6... But now we need 5-6 to be the starting line, when it is 3-6 right now. So let''s give it a ''5'' again. The triangle 3-5-6 has been drawn twice now. Now with 5-6 as the starting line, give it 9 and carry on building the grid.

Risk: Maybe the culling will end up inverted for the second line. (Not good) This means that test #2 would go like this:
After 3-6, give it another ''6'', this creates a degenerate triangle 3-6-6. Then give it a ''5'', for degenerate triangle 6-6-5. Now with 6-5 in the buffer, toss in the 9 and carry on.

=^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.