Results 1 to 5 of 5

Thread: UV Mapping

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    2

    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:
    Code :
    <technique sid="COMMON">
              <phong>
                <diffuse>
                  <texture texture="texture0-sampler" texcoord="tex0" />
                </diffuse>
              </phong>
            </technique>

    Geometry:

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

    Geometry instance:
    Code :
     <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.

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: UV Mapping

    Quote Originally Posted by ibachar
    First, in bind_vertex_input shouldn't the input_semantic be "TEXCOORD" and not "TEX_COORD"?
    Yes.
    Quote Originally Posted by ibachar
    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?
    Yes this appears wrong. The input_set has to match between (the desired set in) the geometry and the bind.

  3. #3
    GCarty
    Guest

    Re: UV Mapping

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

    I have a Collada file with a section

    Code :
    <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

    Code :
    <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?

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: UV Mapping

    Quote Originally Posted by GCarty
    By the way, must the sets in the "input" lines be in ascending order?
    No.
    Quote Originally Posted by GCarty
    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?
    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.

  5. #5
    Junior Member
    Join Date
    Jul 2010
    Posts
    2

    Re: UV Mapping

    Thank you all for your replies.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •