XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Strange problem with CustomModel sample pipeline

Last post 3/17/2009 5:40 AM by clayman. 2 replies.
  • 3/16/2009 7:22 AM

    Strange problem with CustomModel sample pipeline

    Hi all

    I set a break point in the CustomModelProcessor.cs ProcessNode() method to see how data is organized between MeshContent,GeometryContent and VertexContent. To my understanding, MeshContent may have several GeometryContent children, but they all reference to the same vertex of MeshContent. GeometryContent and VertexNode have a one-on-one mapping relation ship,VertexNode indicate which vertex are actually referenced by GeometryContent. So if MeshNode has n vertex then any child GeometryContent may only has m(m<=n) vertex,right?

    However the debug data shows: the root MeshContent of tank model which is named "tank_geo" has a vertex count of *609*, it has only one GeometryContent. The strangle thing is this GeometryContent and its VertexContent has a vertex count of *1406*! I also find there're a lot duplicate positions in VertexContent.Positions(I tried  MergeDuplicateVertices, but seems it takes no effect). Finally,the code create a vertexBufferContent which has 1406 element instead of 609.

    so why there're more vertex in GeometryContent than MeshContent and also those duplicate positions? Is this a bug or just I misunderstand the relationship between those classes and data?
  • 3/16/2009 5:43 PM In reply to

    Re: Strange problem with CustomModel sample pipeline

    The Content Pipeline object model makes a distinction between vertices and positions.

    MeshContent holds positions, not vertices. There is one position for every unique point in 3D space that is used by that mesh.

    GeometryContent, on the other hand, holds vertices. A vertex has a position, but also other data channels such as normals, texture coordinates, and colors. Each vertex holds an index into the list of positions (stored in VertexContent.PositionIndices). If several vertices use the same position index, they will all share the same underlying position. This is common in cases where there is more than one vertex in the same physical location. For instance a cube would have 8 positions, but most likely would use different normal vectors for each face, so there would be 24 vertices. Or you might have two vertices that have the same position and normal, but different texture coordinates, if the model has been uv mapped with a different part of the texture on two adjacent triangles.
    XNA Framework Developer - blog - homepage
  • 3/17/2009 5:40 AM In reply to

    Re: Strange problem with CustomModel sample pipeline

    that's make perfect sense
    thanks shawn :)
Page 1 of 1 (3 items) Previous Next