Originally posted by Cyranose:
[b] Ignoring the tangential issues here, the original question was whether it’s useful to have separate indices for the various vertex components when using vertex arrays.
Unfortunately, it is (and not just for the cube example), though I don’t think it would be easy to even simulate unless such an extension converts multi-indexed data to single-indexed data by duplicating on the fly (yuck, no go).
The desire for such a feature (for me) is not to avoid duplicating colors or texcoords in memory. It’s mainly to avoid duplicating vertices where two vertices at the same point in space have different attributes, such as different normals, different texcoords, or different colors.
The problem comes in in trying to optimize vertex caching. Two nearly identical vertices can’t be cached as one. This shows up wherever you need discontinuities in normals (e.g., hard edges), colors, or texcoords.
But under the hood, it’s likely that the vertex cache stores not only the post-transformed vertex (and normal) but the other post-transformed post-lit parameters too, all keyed by the original index value. So there’s a real question as to whether such an extension could reasonably be supported in HW without multiple caches and lots of extra complexity. And it doesn’t make much sense for vertex programs, where you’d want to cache the computed VP outputs, not the separate inputs.
Anyway, back to the original question. If you have a small number of colors, normals, and/or tex coords and want to re-use those with separate indices, you can simulate this “extension” with a simple vertex program. Load your arrays colors, texcoords, normals, into VP constants (up to the limits, say 96 total vec4s for 1st gen HW) and send down vertices with XYZ and color only. In the VP, use those color R,G,B values to do one or more table lookups for real colors, texcoords, and normals stored in the registers and emit the combined result.
This, of course, does not solve the cache re-use issue either. But I assume (or at least hope) vertices are cached post VP execution.
Avi
[This message has been edited by Cyranose (edited 08-15-2003).][/b]
Hello, as far as complexity goes i think it is very possible. Infact the biggest problem is bus bandwidth and not the processor on the card. Infact this problem could be very simple to solve on the card.
Currently there is a vertex, texture coords, normals and colors buffers on the card. Then of course there is a list that goes though and says something along the lines of
i = index
vertexArray[i], normalArray[i] and so on.
Do you really think that this would become alot more complicated if the had something a
v = vertexindex
n = normalindex
vertexArray[v], normalArray[n]
If the index list was something along the lines of a packed array
indexlist = vertex, normal, color, texture;
instead of just indexlist = vertex
I really find this hard to believe that this will add large amounts of complexity to a card.
Later, Ben