submeshes

Help
r3dwolf
2013-03-29
2013-10-31
  • r3dwolf

    r3dwolf - 2013-03-29

    i need to import in my application a model that have multimesh object (multimaterial)

    An example is this simple obj file

    #
    # object Box002
    #
    v  4.5958 0.0000 24.3693
    v  4.5958 0.0000 -25.6307
    v  54.5958 0.0000 -25.6307
    v  54.5958 0.0000 24.3693
    v  4.5958 50.0000 24.3693
    v  54.5958 50.0000 24.3693
    v  54.5958 50.0000 -25.6307
    v  4.5958 50.0000 -25.6307
    v  -55.4042 0.0000 24.3693
    v  -55.4042 0.0000 -25.6307
    v  -5.4042 0.0000 -25.6307
    v  -5.4042 0.0000 24.3693
    v  -55.4042 50.0000 24.3693
    v  -5.4042 50.0000 24.3693
    v  -5.4042 50.0000 -25.6307
    v  -55.4042 50.0000 -25.6307
    # 16 vertices
    vn 0.0000 -1.0000 -0.0000
    vn 0.0000 1.0000 -0.0000
    vn 0.0000 0.0000 1.0000
    vn 1.0000 0.0000 -0.0000
    vn 0.0000 0.0000 -1.0000
    vn -1.0000 0.0000 -0.0000
    # 6 vertex normals
    vt 1.0000 0.0000 0.0000
    vt 1.0000 1.0000 0.0000
    vt 0.0000 1.0000 0.0000
    vt 0.0000 0.0000 0.0000
    # 4 texture coords
    g Box002
    usemtl Materiale_4
    f 1/1/1 2/2/1 3/3/1 
    f 3/3/1 4/4/1 1/1/1 
    f 5/4/2 6/1/2 7/2/2 
    f 7/2/2 8/3/2 5/4/2 
    f 1/4/3 4/1/3 6/2/3 
    f 6/2/3 5/3/3 1/4/3 
    f 4/4/4 3/1/4 7/2/4 
    f 7/2/4 6/3/4 4/4/4 
    f 3/4/5 2/1/5 8/2/5 
    f 8/2/5 7/3/5 3/4/5 
    f 2/4/6 1/1/6 5/2/6 
    f 5/2/6 8/3/6 2/4/6 
    usemtl Materiale_3
    f 9/1/1 10/2/1 11/3/1 
    f 11/3/1 12/4/1 9/1/1 
    f 13/4/2 14/1/2 15/2/2 
    f 15/2/2 16/3/2 13/4/2 
    f 9/4/3 12/1/3 14/2/3 
    f 14/2/3 13/3/3 9/4/3 
    f 12/4/4 11/1/4 15/2/4 
    f 15/2/4 14/3/4 12/4/4 
    f 11/4/5 10/1/5 16/2/5 
    f 16/2/5 15/3/5 11/4/5 
    f 10/4/6 9/1/6 13/2/6 
    f 13/2/6 16/3/6 10/4/6 
    # 26 faces
    #
    # object Box003
    #
    v  4.5958 0.0000 91.1967
    v  4.5958 0.0000 41.1967
    v  54.5958 0.0000 41.1967
    v  54.5958 0.0000 91.1967
    v  4.5958 50.0000 91.1967
    v  54.5958 50.0000 91.1967
    v  54.5958 50.0000 41.1967
    v  4.5958 50.0000 41.1967
    v  -55.4042 0.0000 91.1967
    v  -55.4042 0.0000 41.1967
    v  -5.4042 0.0000 41.1967
    v  -5.4042 0.0000 91.1967
    v  -55.4042 50.0000 91.1967
    v  -5.4042 50.0000 91.1967
    v  -5.4042 50.0000 41.1967
    v  -55.4042 50.0000 41.1967
    # 16 vertices
    vn 0.0000 -1.0000 -0.0000
    vn 0.0000 1.0000 -0.0000
    vn 0.0000 0.0000 1.0000
    vn 1.0000 0.0000 -0.0000
    vn 0.0000 0.0000 -1.0000
    vn -1.0000 0.0000 -0.0000
    # 6 vertex normals
    vt 1.0000 0.0000 0.0000
    vt 1.0000 1.0000 0.0000
    vt 0.0000 1.0000 0.0000
    vt 0.0000 0.0000 0.0000
    # 4 texture coords
    g Box003
    usemtl Materiale_2
    f 25/5/7 26/6/7 27/7/7 
    f 27/7/7 28/8/7 25/5/7 
    f 29/8/8 30/5/8 31/6/8 
    f 31/6/8 32/7/8 29/8/8 
    f 25/8/9 28/5/9 30/6/9 
    f 30/6/9 29/7/9 25/8/9 
    f 28/8/10 27/5/10 31/6/10 
    f 31/6/10 30/7/10 28/8/10 
    f 27/8/11 26/5/11 32/6/11 
    f 32/6/11 31/7/11 27/8/11 
    f 26/8/12 25/5/12 29/6/12 
    f 29/6/12 32/7/12 26/8/12 
    usemtl Materiale_1
    f 33/5/7 34/6/7 35/7/7 
    f 35/7/7 36/8/7 33/5/7 
    f 37/8/8 38/5/8 39/6/8 
    f 39/6/8 40/7/8 37/8/8 
    f 33/8/9 36/5/9 38/6/9 
    f 38/6/9 37/7/9 33/8/9 
    f 36/8/10 35/5/10 39/6/10 
    f 39/6/10 38/7/10 36/8/10 
    f 35/8/11 34/5/11 40/6/11 
    f 40/6/11 39/7/11 35/8/11 
    f 34/8/12 33/5/12 37/6/12 
    f 37/6/12 40/7/12 34/8/12 
    # 24 faces
    

    In my application i have to reconstruct the 2 object with 2 submeshes each one.
    How is this possible?

    I try to import the file but i've not two node with 2 meshes as expected but i have 4 nodes with single mesh..

     
  • Michail Vidiassov

    I believe your problem is caused by erroneous fix for bug https://sourceforge.net/p/assimp/bugs/57/ .

    Comment out the "if" clause after "Each material request a new object." comment in ObjFileParser.cpp and your hair will get smooth and shiny.

     

Log in to post a comment.