Many submeshes result in skewed UV

Hi folks,
It’s been a while since i’ve posted but luckily I havn’t had any Collada problems :smiley:

I am writing today for some advice on some exports. For high poly versions of the models i’m exporting (in a proprietary format btw) the models are broken into several index buffers and positions/uvs. The problem is that every UV map following the first is skewed even though the data appears accurate and even the Collada coherency check agrees. Although when importing it into model viewers, the viewer either crashes, attaches the UV similar to below or the UV mapping dissappears altogether (because the data is bad?)

[attachment=0:a31or5iw]fat_zombie_uv_prob.jpg[/attachment:a31or5iw]

Note: I had to invert the Y axis of the first UV to correct the orientation.

I could use any advise to guide me in the right direction. I have attached an example model although it is different one to the zombie above. Many thanks, Maeyan

http://www.hellgateaus.net/files/skewed_uv.rar File Size: ~500kb

I had a quick look at the dae, and here’s some comments:

  • you are using ‘set’ with Input semantic=“VERTEX”. Although it is an interesting concept (having a set of vertices one could switch from when instancing the geometry) it is not part of the specification. Moreover, you are not definining more than one set of vertices, so I would remove ‘set’ attribute for all “VERTEX” semantic
  • you are using ‘set’ with Input semantic=“TEXCOORD”, wich is fine since more than one UV mapping may exist for each vertex, but in your case you are defining only one set per primitive, so it should be removed.
  • your material has only one mapping to texture coordinates (“uv_0”) for diffuse texture. (ok)
  • your binding is binding only one set of textures (“uv_0” is mapped to input_set=“0”). Which is fine since all your geometry is using the same material, but indicates again that all the primitives should be defined with set=“0” for the “TEXCOORD” semantic

I hope this helps

Excellent mate! I was hoping it was an implementation problem… i’ll let you know. :slight_smile:

I adjusted the set attributes as you suggested but I still encounter the same errors. Assuming the UV data is okay (they are all floats between 0 and 1), what else in the implementation could be causing inconsistencies? I could merge all the UV data into one array but it’s probably important to keep the model divided into several parts(?). Many thanks for your input.


				<triangles material="mtl" count="81">
					<input source="#elemental_blue_mesh-vertices" set="2" semantic="VERTEX" offset="0"/>
					<input source="#elemental_blue_mesh-uv-map-1" set="2" semantic="TEXCOORD" offset="0"/>

I had a quick look too and notice that you are using the same index (offset=0) values to stream both your vertex and texture coordinates. Is your data really organized that way?