Archived

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

Oniera

Triangle Lists and optimization

Recommended Posts

Will triangle fans and triangle strips actually render faster than triangle lists? Or is the speed benefit from using these better just because we are sending less data to the video card? Also, once you create a vertex buffer than optimize it, does D3D automatically turn the data in the buffer to the most efficient formation? Demetrios Georgeadis Director/Programmer Oniera Software Artists

www.oniera.com

Share this post


Link to post
Share on other sites
The speed benefit from __strips__ CAN come from:

a) sending less vertices over the bus to the card.

b) using less vertices per polygon which means less vertices to transform, which means less maths for the CPU/GPU to do. Strips are usually 1 vertex per polygon wheras an indexed triangle list tends to have between 1.5 and 2 vertices per polygon.


Much more important than primitive type though is good batching. You want to reduce the number of DrawPrimitive* calls to as few as possible. Sending less than 20 polygons to D3D per DrawPrimitive* call creates terrible performance. Ideally you should be sending between 100 and 3000 polygons per call. Because of this:

a) unless your world has lots of circles and cones with lots of polygons per shape, fans are *EVIL*. Many people end up trying to use fans for ROAM implementations and wonder why their performance is so bad. Sending a single quad at a time is not good.

b) for strips you need to have significant length for each strip (i.e. 100 to 3000 polys) to get good performance, otherwise you get the same problem. Using degenerate triangles can help to extend the length of a strip in many cases. If your model data doesn''t generate long strips you''ll get better performance using indexed triangle lists instead. Strips can also be indexed too to give even lower vertex per polygon counts (provided the vertex is in the vertex cache).


What do you mean by "once you create a vertex buffer than optimize it" ?
- are you talking about the DirectX 7 Optimize() method for a vertex buffer ?
- are you talking about the vertex cache optimisation functions in D3DX in DX8 ?
- are you talking about using a stripifier (IIRC DX8.1 has one in D3DX).

In all cases, yes they can help provided the input model is suitable (garbage in, garbage out) - how much they can help and "most" efficient depends on which method and totally depends on your models!.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Thanks for the reply.

Ok, from what you have told me I think I''m going to use indexed triangle lists in conjunction with DX7->optimized vertex buffers for stationary objects. (I currently use regular tri lists with optimized vertex buffer)

Demetrios Georgeadis
Director/Programmer
Oniera Software Artists

www.oniera.com


Share this post


Link to post
Share on other sites