Skip to main content
gamedev.net
🔒 Locked

Rendering multiple objects

Started by Nairou 1 reply 300+ views
Original Post
Nairou
Nairou
As far as vertex grouping for rendering, from what I''ve heard it sounds like most people group all vertices by texture, to reduce texture switching. But lets say there are multiple objects (or fragments of objects) using a specific texture. Naturally all of the objects are in your main dynamic vertex buffer, but is each object still drawn separately? Or is it best to try to combine them all using linking tris (I forget what they''re called, the one-dimentional tris for connecting lists) so that its just one long triangle list for each texture? If linking tris are used, some of the connected objects could potentially be very far apart. Is there any problem in having these linking tris stretched out so far, such as floating point errors or clipping complexities? I hope this makes sense, any input would be great.
neneboricua19
neneboricua19
What you''re referring to are called degenerate triangles. These are triangles where two of the three vertices specified are the same and will thus not be rendered.

It is a good idea to render all geometry that uses one particular texture using a single Draw*Primitive call. One thing though that will probably make your life easier is that you don''t necessarily have to use degenerate triangles. Degenerate triangles are used when your vertex data is stored as a triangle strip. If you use a triangle list, you don''t have to worry about degenerate triangles.

A few years ago, triangles strips were noticably faster than triangle strips, but this is not the case anymore. Recent graphics cards have been optimized to perform best with triangle lists.

In a few specific cases, triangle strips can give better performance. For example, when rendering terrain, you can use a triangle strip along with degenerate triangles to make one row of your terrain fit exactly in the cache of the graphics card so that each vertex is transformed only once. But this requires specific knowledge of the hardware, which is usually not available unless you''re working on a console and are under NDA.

In general, triangle lists are easier to dowrk with and will give you equal performance to triangle strips.

neneboricua
Nairou
Nairou
Very interesting! Everything I''ve read so far naturally says to stick with strips, so I''ll have to look more into lists now, that could be very handy. Thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.