I’m using vertex arrays with shared vertices in my OpenGL program, but I’ve run into a problem with the way Blender assigns texture coordinates. Blender can reference the same vertex in different faces, but generate different texture coordinates on faces which reference that vertex.
Is there a setting in Blender that will force it to use the same texture coordinates for each vertex in the model? If two faces reference vertex 0 (for example), I need the texture coordinates for both references to vertex 0 to be the same.
If I understand what you are saying, it is necessary that Blender does it that way. Consider unwrapping a sphere and having all of the vertices’ coordinates be the same. It would be impossible to have a picture of, for example, the earth wrap around the entire sphere. (It could be more like unwrapping from view.)
Idergemkr, whilst it’s not desirable in most uses to have one UV per vertex, there are some external apps that can’t handle more than one…
In your sphere example on the last polygon it’d “mirror” all the way back to “0”…
Of course, you could manually split the last edge so that you have two sets of vertices on top of each other but not a shared edge… that way the earth would be un-wrapped properly…
Most game engines split the geaometry to double up the vertices on seams and will usually modify the vertex normal at these duplicates so that it shades properly…
As for doing it in python… no idea, but couldn’t you just get the UVs at a vertex for all the polys that use it and 2average2 them?
…or are you asking how to GET all the polys at that vertex and how to get their UVs?
Sorry i’m not much help…
Thanks for replying, dergemkr. I don’t want all the vertices’ texture coordinates to be the same. I want the texture coordinates for each particular vertex to be the same each time that vertex is referenced. The shared vertex buffer mode I’m using in OpenGL won’t work with multiple texture coordinates per-vertex.
Averaging the texture coordinate didn’t work. I’m going to have to use OpenGL’s less efficient form of vertex arrays, which treats each face as a completely separate polygon and which allows for different texture coordinates each time a vertex is referenced.
I used “Unwrap (smart projections)”, which seems to work great without specifying seams. I have never been able to understand where to mark seams for unwrapping. The other unwrapping modes result in a tightly packed, tangled mess.
I converted my engine to use glDrawArrays instead of glDrawElements, modified my export script to output 3 sets of texture coordinates per face, and now get perfect texture exports.