Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Assimp and unique vertices

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    2

    Assimp and unique vertices

    Hi,

    I am using Assimp to load obj files into my program. I want to take that data and construct my own data structure. My problem is that Assimp by default loads in repeated vertices, based on however many faces point to each vertex. So for a cube, I would want Assimp to load only 8 vertices.

    For a more explicit example, here is part of the obj file maya outputs for a simple cube:

    v -1.000000 -1.000000 1.000000
    v 1.000000 -1.000000 1.000000
    v -1.000000 1.000000 1.000000
    v 1.000000 1.000000 1.000000
    v -1.000000 1.000000 -1.000000
    v 1.000000 1.000000 -1.000000
    v -1.000000 -1.000000 -1.000000
    v 1.000000 -1.000000 -1.000000

    ...

    f 1 2 4 3
    f 3 4 6 5
    f 5 6 8 7
    f 7 8 2 1
    f 2 8 6 4
    f 7 1 3 5

    I would like assimp to give me that data. Instead, it gives me indices from 1->23, and repeats the vertices to match those indices.

    I tried using aiProcess_JoinIdenticalVertices in my call to Importer::ReadFile, but that did not have the desired effect.

    Has anyone had a similar problem and found a fix?

    Thanks!

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    here is part of the obj file maya outputs for a simple cube
    Where's the rest of it? You know, the part that shows that these are not identical vertices. The normals, colors, texture coordinates, etc.

    See, what Open Asset is doing is properly preparing your data for rendering, which does not allow the kind of thing you're trying to do. You cannot render (without effort) using separate index lists for each attribute. You get one index, which indexes into all attributes at the same time. So if a position is used by two different normals, it must be split into two positions.

    Unless you are not trying to render with this mesh, I suggest you let Open Asset do its job. And if you need Open Asset to do what you're suggesting... you can't. Its mesh system and data structures simply do not allow each attribute to have a separate index.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    2
    I guess I don't really want to render directly from this mesh then. I want to make my own mesh and render from that. The reason for that is all of my other code is based on my own structure, so I was trying to make assimp conform to that.

Tags for this Thread

Posting Permissions

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