Skip to main content
gamedev.net
🔒 Locked

Vertex Equality?

Started by Gammastrahler Dec 8, 2005 at 7:28 AM 2 replies 650+ views
Original Post
Gammastrahler
Gammastrahler
Hi, i´m a little bit confused about this: In an indexed polygon mesh, if a vertex is added which equals a vertex already in the mesh, it is not added, but instead the index of the vertex already in the mesh is used. But how do i compare two vertices? it isn´t just enough to compare just the x, y, and z values, since my tex coords for a vertex with the same x, y and z coords can still be different. and then even the lightmap coords can be different, an so on. but when i compare all these, i do not save any vertices in my indexed polygon mesh and therefore this has no advantage over storing them as duplicates. should i maintain a separate indexed array of texcoords and lightmap coords? would be nice if you could give me some hints on this topic! thanks Gammastrahler
Trienco
Trienco
Quote:
Original post by Gammastrahler
should i maintain a separate indexed array of texcoords and lightmap coords?


That would be pretty pointless unless you're not using one of the existing 3D APIs. They won't let you use more than one index array anyway. The more interesting question is: why would two vertices in the same position have several different texture coordinates and how can I avoid that (for example by "prepping" my textures). Especially confusing when it comes to the lightmap.
f@dzhttp://festini.device-zero.de
Gammastrahler
Gammastrahler
Quote:
The more interesting question is: why would two vertices in the same position have several different texture coordinates and how can I avoid that (for example by "prepping" my textures). Especially confusing when it comes to the lightmap.

For example, consider you have a simple cubic room: i want different textures for the walls, ceiling and floor. each vertex of this "hollow cube" shares three faces, consider a vertex A which is the first vertex for the room´s left wall has a tex coord of (s=0, t=0), but a vertex B which is the second vertex of the front wall, and has the same xyz coords as A, has the tex coords (s=1, t=0).
Trienco
Trienco
Then it's just like the normals when displaying a cube. It's not the same vertices, unless you throw at least the four wall textures into a single texture. I'd still consider that a non issue because once things are starting to become all prettified and fancy you will have more than a simple texture for a whole wall anyway (and duplicating these few vertices won't kill your performance anyway).

A more "typical" mesh won't have sharp edges or corners all over, so the majority of vertices doesn't happen to be one of those "special" vertices that are almost but not quite the same. Not to mention that if you have to render each wall seperately to change textures in between that's probably having more impact than a even a few hundred duplicate vertices.
f@dzhttp://festini.device-zero.de

Topic Locked

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

Sign in to reply to this topic.