View Full Version : Vertex re-use with vertex arrays
I thought one of the advantages with with vertex arrays was vertex re-use (that is, gl recognizes previously drawn vertices).
My problem is, since I'm using all pointers (vertex, texture, normals, colour and probably one more texture), hardly any vertex share ALL these properties when used in two different faces. Two vertices with the same position in space, the same texcoords but different normals must therefore be treated as two entirely different vertices.
The result of this is that the number of vertices in my vertex array equals the number of faces times three, and no vertex re-use is possible. Since I want quite a lot of faces in my scene, I'd like to keep the number of different vertices to a minimum.
Is there some other solution to this problem?
For static objects, display lists might be of interest. If you want to use vertex arrays, there isn't much you can do if you don't have that many shared vertices, thats just the way it is.
To improve speed, you must also use a proper format. You can look at the OpenGL performance FAQ at NVIDIA (http://www.nvidia.com) . Even though it is written specifically for NVIDIA hardware, it might apply to other aswell. Some combinations of formats is more optimized that others.
I looked into that FAQ, and managed to improve renderingspeed quite a bit just by choosing an optimized format.
P.S. Look in the developer section @ NVIDIA for that FAQ.
03-17-2001, 02:53 PM
Matt/Cass - do you know if that FAQ going to be updated? I gather quite a bit of the vertex-format related stuff is obsolete as of the latest driver release.
03-17-2001, 03:08 PM
hult, I have the answer to your question. I asked this same question here and the solution was far easier than I expected. All ya gotta do is treat each set of: vertices, normals, colors, and uvs as one group. Check to see which groups are common to other groups and then parse out all groups that are already shared by other groups.
Did that make sence?
Anyway, we've determined in my "Want to test my demo" thread that my method of parsing duplicate data is expensive. I haven't a clue how the big boys do it so fast :/.
03-17-2001, 11:09 PM
hard core mmx-etc-extendet brute force assembler perhaps http://www.opengl.org/discussion_boards/ubb/smile.gif, who knows?
and i dont think they copy so much mem around in fact..
WhatEver, I've actually been doing that duplicate data check, but only for vertex/texture vertex data. I did it at "compile time" in my 3D Studio Max exporter plug-in (no need for speed then...).
Are you sure the "big boys" really check for duplicates? Does anybody know how much vertex data I can save by checking for duplicates?
03-18-2001, 12:22 AM
>Is there some other solution to this
i really don't think this should go under as a _problem_ for say...
just use a display list..
the driver will try it's best to pack it in the most optimal place..
if your on a NV 1X series and beyond card, you could try packing your vertices using VAR..
[This message has been edited by kaber0111 (edited 03-18-2001).]
03-18-2001, 01:30 AM
I certainly weld vertices and UV coords when importing 3DS. I've optimised the procees a lot, I use assembler and I split the vertices into regions before welding them. It's fast but I still don't do it for single meshes that have more than 20k vertices.
The 3DS format splits vertices where there are mismatched UV coords for the same vertex. How many duplicate vertices you will save depends on the UV coords.
This also implies that you only need to weld uv coords matching in index with the vertices you weld. Separate vertices and uv coords are created for every face that uses a vertex with more than one UV coord.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.