PDA

View Full Version : Vertex array with differ-normals of one vertex



Apollo
07-31-2009, 06:36 PM
Vertex array is useful for different faces with duplicated vertices. But what shall I do if the vertex has different normal(texture) data for different faces? Make it duplicated vertices in array with different normal(texture) information? Or is there any better solution?

scratt
07-31-2009, 09:45 PM
It sounds like you are referring to element arrays, which reference into batches of vertex arrays.

Unfortunately the way element arrays work means that each array of textcoords, colour data and so on run parallel to each other in any draw call, so AFAIK (when using the standard pipeline) elements with identical vertices but differing normals, colours and so on have to be duplicated in their entirety.

If you are worried about the amount of data you are shuffling around you could look at more efficient formats for vertex data which will reduce transfer bandwidth. Say, using bytes for colour data and so on.

Depending on the complexity of your vertex data you could perhaps have lots of small sets of vertex arrays which you pair up with different texture and normal data arrays.. But the function call overhead and complexity is probably not worth it.

Another option is to use geometry shaders to procedurally construct certain aspects of your vertex data that change by using an attribute in yet another side array paired with your vertex data...

Apollo
08-01-2009, 06:15 AM
Thank you very much.