Results 1 to 4 of 4

Thread: How <triangles /><input semantic="VERTEX"

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    4

    How <triangles /><input semantic="VERTEX"

    Hello, I'm trying to find out how the values found in

    are related to the values in the <float_array id="Box01-mesh-positions-array"> (see code pasted below of a simple cube)

    I know that the values in

    are accessed 3 at a time in this example, and that the ones on offset="0" are related to the <float_array id="Box01-mesh-positions-array"> somehow (or are they?)

    But when I begin to read the

    I see

    0 9 2

    and I can't figure out what these numbers mean, when there's a 9.. it seems like it couldn't be referring to the vertices because there are only 8 vertices, this is just a simple cube.

    Code :
    <source id="Box01-mesh-positions">
      <float_array id="Box01-mesh-positions-array" count="24">-0.5 -0.5 0 0.5 -0.5 0 -0.5 0.5 0 0.5 0.5 0 -0.5 -0.5 1 0.5 -0.5 1 -0.5 0.5 1 0.5 0.5 1</float_array>
      <technique_common>
        <accessor source="#Box01-mesh-positions-array" count="8" stride="3">
          <param name="X" type="float"/>
          <param name="Y" type="float"/>
          <param name="Z" type="float"/>
        </accessor>
      </technique_common>
    </source>
    <source id="Box01-mesh-map-channel1">
      <float_array id="Box01-mesh-map-channel1-array" count="36">0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0</float_array>
      <technique_common>
        <accessor source="#Box01-mesh-map-channel1-array" count="12" stride="3">
          <param name="S" type="float"/>
          <param name="T" type="float"/>
          <param name="P" type="float"/>
        </accessor>
      </technique_common>
    </source>
    <vertices id="Box01-mesh-vertices">
      <input semantic="POSITION" source="#Box01-mesh-positions"/>
    </vertices>
    <triangles material="ColorMaterial_39088800" count="12">
      <input semantic="VERTEX" source="#Box01-mesh-vertices" offset="0"/>
      <input semantic="TEXCOORD" source="#Box01-mesh-map-channel1" offset="1" set="1"/>
     
     
    0 9 2 11 3 10 3 10 1 8 0 9 4 8 5 9 7 11 7 11 6 10 4 8 0 4 1 5 5 7 5 7 4 6 0 4 1 0 3 1 7 3 7 3 5 2 1 0 3 4 2 5 6 7 6 7 7 6 3 4 2 0 0 1 4 3 4 3 6 2 2 0</p>
    </triangles>

    edit: after about an hour of testing, I finally realized it's parsed as one value for every 2 values read in:

    0 2 3 3 1 0 ...

    Just in case anyone else had trouble.

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    In this particular example, the <triangle> primitive has 2 inputs, the first one is the VERTEX the second one is the TEXCOORD.

  3. #3
    Jalf
    Guest
    In extension of this, I've got a little question too.
    What exactly is the difference between the inputs listed under <triangles> and the one(s) under <vertices>? (You can have more than one input there as well, right?)

    Which ones should go where? (And what would happen in the above file, if I moved the TEXCOORD input tag to <vertices> instead?
    Or for that matter, if I read the positions from an input inside <triangles> instead of in <vertices>?

  4. #4
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    What exactly is the difference between the inputs listed under <triangles> and the one(s) under <vertices>? (You can have more than one input there as well, right?)
    This is often a source of confusion in Collada. See this thread for an answer.
    Which ones should go where? (And what would happen in the above file, if I moved the TEXCOORD input tag to <vertices> instead?
    Or for that matter, if I read the positions from an input inside <triangles> instead of in <vertices>?
    Positions have to go in <vertices>, everything else can go either in <vertices> or <triangles>/<tristrips>/etc. There used to be some software that wouldn't load anything other than positions out of <vertices> (i.e. if you had tex coords in <vertices>, they wouldn't load), but that's a bug and I think most of these programs have since been fixed.

Posting Permissions

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