Multiple UV Coords per Vertex for a Lightmapper

I (like everyone else it seems) am in the process of creating a lightmapper. With my current implementation, every quad (could be a tri) recieves its own little lightmap. Pretty standard, really.

My problem is that vertices that are shared between quads have unique UVs (depending which quad is being rendered). To the best of my knowledge, OpenGL only allows 1 UV per vertex, meaning that if I have a single “physical” vertex shared by 4 quads, I actually need to pass 4 vertices to OpenGL, all the same, except for their UVs.

I am afraid of transforming the same vertex multiple times, just to get the UVs correct. Is there a way that I can specify multiple UVs per vertex?

I anticipate that for a 5000 quad mesh, I might have to transform 20000 vertices!! (4 vertices per quad)

A similar problem occurs in character skinning where a the vertices at texture seams have different UVs, but the same spatial and normal information.


> I am afraid of transforming the same vertex multiple times, just to get the UVs correct. Is there a way that I can specify multiple UVs per vertex?

No, however, if you design your lightmapper correctly, when two quads are near one each other, you can put their lightmaps one each other too in the lightmap bank ( which you are probably using, to reduce texture switches overhead, right? ). That way, the lightmap coord is the same, and you only need to transform the vertex once.


When the vertex is for something like a
sharp corner, the u/v will not be the same
for both vertexes. Or, at least, you cannot
come up with a unique u/v coloring for all
the vertexes in any given mesh that will

If you have hardware T&L, you will have to
have the hardware transform the vertexes
twice, but that shouldn’t kill you. If you
don’t have hardware T&L, you can structure
your own transform to re-use the coordinates
and just drop in new u/v. And before someone
says “that’s GL’s problem,” consider that
with careful hand-coding, you can out-perform
OpenGL transform. The question is how willing
you are to go the extra distance :slight_smile:

Yes, we are using Hardware T&L and will just eat the cost as much as we have to. I’m sure that there are more optimizations available, but I don’t know that we have the time/skill to redo the existing pipeline AND make it more optimized than the folks at NVIDIA have already done!

Thanks everyone for your feedback,

maybe i misunderstood but would CVA’s help u out eg

glDRawElements(…) etc

Will Compiled Vertex Arrays transform the vertex once? Even if the vertex have different UVS? (just the same 3d coordinate)

Yes, if you lock the vertex array before enabling and setting the texture coordinate array pointer, the vertices will only be transformed once.

[This message has been edited by DFrey (edited 10-20-2000).]