Advertisement

Culling in triangle strips

Started by February 24, 2003 12:34 PM
2 comments, last by Marty666 22 years ago
When I use a triangle strip in a vertex array for heightmapping, the indexes for the triangles are set up like this for a 3*3 map (U = up, D = down) 1 4 2 5 3 6 6 9 5 8 4 7 U U U U U U D D D D D D 1__4__7 2/_5_\8 3/_6_\9 from 1 to 6 the triangles are facing up, from 6 to 7 facing down. I can change the culling direction, but only when i render manually, when I call the array all the even rows of my landscape are facing the wrong way. I can change the indexes to 1 4 2 5 3 6 9 5 8 4 7 to correct this, but i get strange edges, is there a better way? thanx, Marty
_____ /____ /|| | || MtY | ||_____|/Marty
render it in 2 strips

using your example:

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

it would go like this
1,2,4,5,7,8 and 2,3,5,6,8,9
Advertisement
consider using a triangle list instead of a standard strip.
it may surprise you but current high end cards (radeon 9700, for example) are actually slightly faster at traingles lists than strips (assuming the lists are well ordered). And making another call to glDrawElements is a very slow thing to do on these cards. It''s not as bad on nvidia cards, but if you end up making calls to drawElements that only render, say, 32 triangles, you are going to be slowing things down a lot.
This doesn''t have as much effect if your not using vertex buffers though (vertex_array_object, vertex_array_range or vertex_buffer_object extensions). If your not using these your biggest limit will be the agp bus anyway. so you probably don''t have to worry as your peak throughput will be around 2 million/tris/sec for 4x agp.

case in point:

I''ve managed to get the following from my radeon 9500Pro

in all these cases I''m dealing with a ~1 million tirangle scene.
The only thing is these were D3D, but it still applies.

using triangle lists with vertex cache friendly ordering, around 70 million/tris/sec max
using triangle strips, around 55 million/tris/sec max
using triangle strips of lengths around ~1000 tris, around 18 million tris/sec max
using traingle lists randomly, around 22 million tris/sec max
Not using vertex buffers at all, 2 million is about max.

although there is some loss of performance when using strips as it''s not quite so easy to be vertex cache friendly... I still feel they arn''t as fast...

But overall I think the numbers speak for themselves.


| - Project-X - my mega project.. yup, still cracking along - | - adDeath - an ad blocker I made - | - email me - |
Is there a tutorial about triangle lists to be found somewhere?

Thanx, Marty
_____ /____ /|| | || MtY | ||_____|/Marty

This topic is closed to new replies.

Advertisement