UV Mapping

Hello,

I’m trying to code a Collada importer but I have problems grasping how texture coordinates are binded.

I have this Collada file and I’m not sure if it was exported correctly:

A diffuse texture:


<technique sid="COMMON">
          <phong>
            <diffuse>
              <texture texture="texture0-sampler" texcoord="tex0" />
            </diffuse>
          </phong>
        </technique>

Geometry:

<input semantic="TEXCOORD" source="#mesh0-geometry-uv" offset="1" set="1" />

Geometry instance:

 <bind_vertex_input semantic="tex0" input_semantic="TEX_COORD" input_set="0" />

First, in bind_vertex_input shouldn’t the input_semantic be “TEXCOORD” and not “TEX_COORD”? Also in the geometry the input tells it to set these texture coordinates as set “1” but then in the bind_vertex_input it tells it to use set “0” as the source for “tex0” shouldn’t they be equal?

Thanks.

Yes.

Yes this appears wrong. The input_set has to match between (the desired set in) the geometry and the bind.

By the way, must the sets in the “input” lines be in ascending order?

I have a Collada file with a section

<input semantic="VERTEX" source="#SSL_road_SSL_road_PREZ_dovergrass-vertex" offset="0"/>
<input semantic="NORMAL" source="#SSL_road_SSL_road_PREZ_dovergrass-normal" offset="1"/>
<input semantic="TEXCOORD" source="#SSL_road_SSL_road_PREZ_dovergrass-0-texcoords" offset="2" set="0"/>
<input semantic="TEXCOORD" source="#SSL_road_SSL_road_PREZ_dovergrass-7-texcoords" offset="3" set="7"/>
<input semantic="TEXCOORD" source="#SSL_road_SSL_road_PREZ_dovergrass-1-texcoords" offset="4" set="1"/>

which is not displayed correctly, but if I change the order to

<input semantic="VERTEX" source="#SSL_road_SSL_road_PREZ_dovergrass-vertex" offset="0"/>
<input semantic="NORMAL" source="#SSL_road_SSL_road_PREZ_dovergrass-normal" offset="1"/>
<input semantic="TEXCOORD" source="#SSL_road_SSL_road_PREZ_dovergrass-0-texcoords" offset="2" set="0"/>
<input semantic="TEXCOORD" source="#SSL_road_SSL_road_PREZ_dovergrass-1-texcoords" offset="4" set="1"/>
<input semantic="TEXCOORD" source="#SSL_road_SSL_road_PREZ_dovergrass-7-texcoords" offset="3" set="7"/>

it displays as it should. Can I get the first order displaying correctly (the Collada file is to import into Maya in order to use Turtle, which I believe requires channel 7 to be in second place)? If so, what do I need to change elsewhere in the Collada file to fix it?

No.

What ever software you are using has a bug in its processing of inputs. It should not depend on the order of inputs or their attribute values.

Thank you all for your replies.