Results 1 to 7 of 7

Thread: <vertices> inconsistency

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Posts
    9

    <vertices> inconsistency

    Hi there!

    As I understood from the specification, all vertex data inside <polygons>, except position is referred to the <source> tag. The vertex position is special and the <source> is referenced indirectly via the <vertices> tag.

    In one of the example files (collada.dae) vertex position in referred directly to the <source> in one of the <polygons>. Is that correct?

    Why vertex position has a dedicated tag, unlike all other parametres? According to the Core Categories in the chapter 2 (Format Overview), using dedicated <vertices> tag has a subtle advantage. Then why the rest of the parametres do not have their own tags: <texcoords>, <normals>, etc? That could make it consistent with vertices and would make possible to use the same code instead of making a special case for vertices' positions.

  2. #2

    Re: <vertices> inconsistency

    Quote Originally Posted by IlyaBely
    In one of the example files (collada.dae) vertex position in referred directly to the <source> in one of the <polygons>. Is that correct?
    You must be looking at some very old examples. There is no file called "collada.dae". It's collada.xml and in the version I have, all POSITION inputs are under a vertices element.

    Quote Originally Posted by IlyaBely
    Why vertex position has a dedicated tag, unlike all other parametres? According to the Core Categories in the chapter 2 (Format Overview), using dedicated <vertices> tag has a subtle advantage. Then why the rest of the parametres do not have their own tags: <texcoords>, <normals>, etc? That could make it consistent with vertices and would make possible to use the same code instead of making a special case for vertices' positions.
    The position array defines the "mesh vertices". Mesh vertices are independent of how polygons are added to a mesh and they can have their own attributes (e.g. selected).
    Disconnected polygon-soups would be a pain to use for anything from modeling to skinning to physics, so instead of defining a position for each polygon vertex, polygons simply index mesh-vertices.
    This allows for defining EXACT identities of vertices (which is extremely important topology information) and for a more compact representation.
    A vertex used by two polygons is the same, because it uses the same integer index, not because their float coordinates are "close".

    This is how nearly all modelers and other scene graph-based systems work internally.

  3. #3
    Junior Member
    Join Date
    Feb 2005
    Posts
    9

    Re: <vertices> inconsistency

    Quote Originally Posted by gabor_nagy
    You must be looking at some very old examples. There is no file called "collada.dae". It's collada.xml and in the version I have, all POSITION inputs are under a vertices element.
    Oh, I must have renamed all .xml to .dae and forgot about it. The file in question is examples/collada.xml taken from here:
    viewtopic.php?t=95
    In line 11755 <polygons> refer directly to <source>, while all other <polygons> in that <geometry> refer to <vertices>.

    Quote Originally Posted by gabor_nagy
    The position array defines the "mesh vertices". Mesh vertices are independent of how polygons are added to a mesh and they can have their own attributes (e.g. selected).
    Quote Originally Posted by gabor_nagy
    A vertex used by two polygons is the same, because it uses the same integer index, not because their float coordinates are "close".
    That's true, but the same can be said about normals and texture coordinates too. You need only 6 normal vectors for a cube, and in complex objects, the same normal could be used in many vertices in different polygons.

    I probably was unclear in my first message, my complain is really about the following:

    Currently, the object is defined like this:
    Code :
    <geometry>
    <mesh>
        <source id="pos-data" />
        <source id="norm" />
        <source id="texcoord" />
        <vertices id="vtx">
            <input source="pos-data" />
        </vertices>
        <polygons>
             <input semantec="VERTEX" source="vtx" />
             <input semantec="TEXCOORD" source="texcoord" />
             <input semantec="NORMAL" source="norm" />
        </polygons>
    </mesh>
    </geometry>

    All three vertices' positions, normals, and texture coordinates are independant of each other. Any of them could be used in more than one vertex and/or in more than one polygon. Data for normals and texture coordinates is refered to a <source> directly, while data for the positions is refered to a <source> via <vertices>.

    I do not see why they are defined differently, being used in a so similar way. Something like an example below seems to be more consistent.

    Code :
    <geometry>
    <mesh>
        <source id="pos-data" />
        <source id="norm-data" />
        <source id="texcoord-data" />
        <vertices id="vtx">
            <input source="pos-data" />
        </vertices>
        <normals id="norm">
            <input source="norm-data" />
        </normals>
        <texcoords id="texcoord">
            <input source="texcoord-data" />
        </texcoords>
        <polygons>
             <input semantec="VERTEX" source="vtx" />
             <input semantec="TEXCOORD" source="texcoord" />
             <input semantec="NORMAL" source="norm" />
        </polygons>
    </mesh>
    </geometry>

    Alternatively, all three can refer to <source>s directly, as normals and texcoords do currently.

  4. #4

    Re: <vertices> inconsistency

    As I mentioned, position is special, because it's tightly coupled to the shape and topology of a mesh, hence the use of mesh vertices in most tools. Mesh vertices are entities of their own and can have mutiple attributes (position, selected flag etc.).
    All other vertex attributes are just for shading etc. and can be accumulated under <polygons>
    You can still use a single array (source) for normals etc.
    This becomes more obvious if you have more than just positions for the mesh-vertices:
    Code :
    <vertices id="extrude-1-Vtx">
      <input semantic="POSITION" source="#extrude-1-Pos"/>
      <input semantic="SELECTED" source="#extrude-1-SelFlags"/>
    </vertices>
    Theoretically, you can add normals etc. to the mesh vertices, but 2 polygons might share a vertex (position), yet have different normals at that vertex (on a "hard" edge), so putting them in the mesh vertices would defeat the purpose.

    As for collada.xml, I have:
    Code :
    <input semantic="VERTEX" source="#extrude-1-Vtx" idx="0"/>
    are you saying that your verson has this?:
    Code :
    <input semantic="POSITION" ...

  5. #5
    Junior Member
    Join Date
    Feb 2005
    Posts
    9

    Re: <vertices> inconsistency

    Quote Originally Posted by gabor_nagy
    This becomes more obvious if you have more than just positions for the mesh-vertices:
    Code :
    <vertices id="extrude-1-Vtx">
      <input semantic="POSITION" source="#extrude-1-Pos"/>
      <input semantic="SELECTED" source="#extrude-1-SelFlags"/>
    </vertices>
    So, we can have store selection of vertices, but we can not store selection of normals. If normals were under their own tag, you could store their selection just as well.

    Quote Originally Posted by gabor_nagy
    Theoretically, you can add normals etc. to the mesh vertices, but 2 polygons might share a vertex (position), yet have different normals at that vertex (on a "hard" edge), so putting them in the mesh vertices would defeat the purpose.
    You are perfectly right. But, the reverse is also true, the same normal vector can be shared across many vertices and polygons.

    I'll make a last effort to explain myself clearly.

    Looking at cube, we have 8 positions, 6 normals and and 14 texture coordinates (number of texture coordinates depends on how texture coordinates are mapped, I'm assuming a simple cross-like layout).

    The cube has 6 polygons of 4 points each. The correct term is 'vertices', but I'll call the points to make a distinction from already used <vertices>
    tag. There is no way to assign position, normal and texture coordinate to each point without some duplication. And I'm not suggesting it.

    So, there is 24 points referencing 3 arrays of data via indices: position, normal vectors and texture coordinates. These points are not defined anywhere in COLLADA directly, they are accumulated inside

    as a group of 3 (in this case) indices referencing these arrays.

    So, there is 3 independant arrays of data, but one of them has it's own tag, while other two are treated as raw data.

    Quote Originally Posted by gabor_nagy
    are you saying that your verson has this?
    No, I'm telling about the followong line:
    Code :
    <input semantic="VERTEX" source="#extrude-1-Pos" idx="0"/>
    extrude-1-Pos is a <source>, not <vertices>.
    The rest of <polygons> refer to extrude-1-Vtx like in your line.

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

    Re: <vertices> inconsistency

    Quote Originally Posted by IlyaBely
    Quote Originally Posted by gabor_nagy
    are you saying that your verson has this?
    No, I'm telling about the followong line:
    Code :
    <input semantic="VERTEX" source="#extrude-1-Pos" idx="0"/>
    extrude-1-Pos is a <source>, not <vertices>.
    The rest of <polygons> refer to extrude-1-Vtx like in your line.
    That's a bug in the sample file. Replace "Pos" with "Vtx" like the rest.

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

    Re: <vertices> inconsistency

    Quote Originally Posted by IlyaBely
    Quote Originally Posted by gabor_nagy
    This becomes more obvious if you have more than just positions for the mesh-vertices:
    Code :
    <vertices id="extrude-1-Vtx">
      <input semantic="POSITION" source="#extrude-1-Pos"/>
      <input semantic="SELECTED" source="#extrude-1-SelFlags"/>
    </vertices>
    So, we can have store selection of vertices, but we can not store selection of normals. If normals were under their own tag, you could store their selection just as well.
    You can store any mesh vertex attribute data that you want inside <vertices> including normals. The data contained by <vertices> is invariant to tesselation. Data that depends on tesselation are accumulated inside the collation elements.

Posting Permissions

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