2012-08-06 80 views
0

我目前正在使用Artoolkit(C和C++語言軟件庫,可讓程序員輕鬆開發增強現實應用程序)和Maya2013開展項目。我想知道有沒有人能成功地從maya中導出VRML文件並將其顯示在artoolkit中。 wrl文件可以在cosmoplayer中查看,但是它們不適用於artoolkit。maya及其使用artoolkit的VRML導出

[1] 好吧,如果我簡單的寫

Shape { 
appearance Appearance { 
    material Material { } 
} 
geometry Box { } 

}

它具有的ARToolKit效果很好。

[2] 當我導出模型(即球體)時,它不起作用。這是它的wrl文件。

#VRML V2.0 utf8 CosmoWorlds V1.0 
WorldInfo 
{ 
title "hydrant" 
info "VRML2.0 created with Version 1.3, from Alias Maya 2013" 
} 
NavigationInfo 
{ 
type [ "EXAMINE" ] 
headlight TRUE 
speed  1.000000 
} 
Switch 
{ 
whichChoice -1 
choice 
[ 
    Shape 
    { 
    appearance Appearance 
    { 
    material DEF lambert1_0 Material 
    { 
    diffuseColor 0.400000 0.400000 0.400000 
    specularColor 0.000000 0.000000 0.000000 
    emissiveColor 0.000000 0.000000 0.000000 
    shininess  0.000000 
    transparency 0.000000 
    } 
    } 
    } 
    Shape 
    { 
    geometry DEF pCube1_0Geo IndexedFaceSet 
    { 
    convex FALSE 
    solid FALSE 
    coord DEF pCube1GeoPoints Coordinate 
    { 
    point [ 
     -1.254 -1.013 2.585, 
     1.254 -1.013 2.585, 
     -1.254 1.013 2.585, 
     1.254 1.013 2.585, 
     -1.254 1.013 -2.585, 
     1.254 1.013 -2.585, 
     -1.254 -1.013 -2.585, 
     1.254 -1.013 -2.585 
    ] 
    } 
    coordIndex [ 
    0 1 3 2 -1, 
    2 3 5 4 -1, 
    4 5 7 6 -1, 
    6 7 1 0 -1, 
    1 7 5 3 -1, 
    6 0 2 4 -1 
    ] 
    normalPerVertex TRUE 
    normal Normal 
    { 
    vector [ 
     0.000 0.000 1.000, 
     0.000 0.000 1.000, 
     0.000 0.000 1.000, 
     0.000 0.000 1.000, 
     0.000 1.000 0.000, 
     0.000 1.000 0.000, 
     0.000 1.000 0.000, 
     0.000 1.000 0.000, 
     0.000 0.000 -1.000, 
     0.000 0.000 -1.000, 
     0.000 0.000 -1.000, 
     0.000 0.000 -1.000, 
     0.000 -1.000 0.000, 
     0.000 -1.000 0.000, 
     0.000 -1.000 0.000, 
     0.000 -1.000 0.000, 
     1.000 0.000 0.000, 
     1.000 0.000 0.000, 
     1.000 0.000 0.000, 
     1.000 0.000 0.000, 
     -1.000 0.000 0.000, 
     -1.000 0.000 0.000, 
     -1.000 0.000 0.000, 
     -1.000 0.000 0.000 
    ] 
    } 
    normalIndex [ 
    0 1 2 3 -1, 
    4 5 6 7 -1, 
    8 9 10 11 -1, 
    12 13 14 15 -1, 
    16 17 18 19 -1, 
    20 21 22 23 -1 
    ] 
    } 
    } 
] 
} 
Group 
{ 
children 
[ 
    DEF persp Viewpoint 
    { 
    position -6.664414 5.734681 17.361393 
    orientation -0.626571 -0.770664 -0.116128 0.472021 
    fieldOfView 0.950022 
    description "persp" 
    } 
    DEF pCube1 Transform 
    { 
    translation  0.000000 0.000000 0.000000 
    rotation  0.000000 0.000000 0.000000 0.000000 
    scale  1.000000 1.000000 1.000000 
    scaleOrientation 0.0 0.0 1.0 0.0 
    children Shape 
    { 
    appearance Appearance 
    { 
    material USE lambert1_0 
    } 
    geometry USE pCube1_0Geo 
    } 
    } 
] 
} 

[3] 下面是這工作的ARToolKit文件.WRL的版本

#VRML V2.0 utf8 

Background {     #remove these lines 
skyColor .7 .7 1    # 
}       # when placing this 
Viewpoint {     # 
    position 0 0 7   # object in a VRML world 
    }       # 
NavigationInfo {    # or apartment. 
type "EXAMINE"    # 
}       # 

WorldInfo { 
    title "Animated Snowman" 
    info [ "Copyright 1988 modeled by Kiwano [Andrew Reitemeyer] [email protected] " 
      "This model is linkware. Non commercial users are required to link to" 
        " http://home.t-online.de/home/kiwano4 " 
        "Commercial users must pay a small fee, details and more models from the above url" 
      "This node must remain unaltered in this code" 
      ] 
      }  



Transform {   # main grouping node 
translation 0 0 0  # controls position 
scale 1 1 1   # controls size 
rotation 0 0 0 0  # controls orientation 
    children [ 



DEF Bottom Transform { 
translation 0 -1 0 
    scale 1.2 1 1.2 
    children [ 
    DEF Ball Shape { 
     appearance Appearance { 
      material Material { 
      diffuseColor 1 1 1 
      specularColor .9 .9 1 
      shininess 1 
      ambientIntensity .2 
      # transparency .2 
      } 
     } 
     geometry Sphere { 
     radius 1 
     } 
     } 
     DEF See VisibilitySensor {} 
    ] 
    }  
DEF Middle Transform { 
translation 0 0 0 
    scale .9 .9 .9 
    children [ 
    USE Ball 
    ] 
    }  
DEF head Transform { 
translation 0 .9 0 
    scale .6 .6 .6 
    children [ 
    USE Ball 
    ] 
    } 
DEF Eye1 Transform { 
    translation .35 1.1 .4 
    children [ 
    DEF Eye Shape { 
     appearance Appearance { 
      material Material { 
      diffuseColor 0 0 0 
      specularColor 1 1 1 
      shininess 1 
      ambientIntensity 1 
      } 
     } 
     geometry Sphere { 
     radius .1 
     } 
     } 
    ] 
    }  
DEF Eye2 Transform { 
    translation -.35 1.1 .4 
    children [ 
    USE Eye 
    ] 
    } 
DEF Nose Transform { 
    translation 0 .9 .8 
    rotation 1 0 0 1.57 
    children [ 
    Shape { 
     appearance Appearance { 
      material Material { 
      diffuseColor .8 .5 0 
      specularColor .9 .6 0 
      shininess .3 
      ambientIntensity .2 
      } 
     } 
     geometry Cone { 
     bottomRadius .1 
     height .5 
     } 
     } 
    ] 
    }  
DEF Hat Transform { 
translation 0 0 0 
    children [ 

Transform { 
    translation 0 1.3 0 
    rotation 0 1 1 -.1 
    children [ 
     Shape { 
     appearance DEF Felt Appearance { 
      material Material { 
      diffuseColor 0 0 0 
      specularColor 1 1 1 
      shininess 1 
      ambientIntensity 1 
      } 
     } 
     geometry Cylinder { 
     radius .7 
     height .05 
     } 
     } 
    ] 
    } 
Transform { 
    translation 0 1.6 0 
    rotation 0 1 1 -.1 
    children [ 
     Shape { 
     appearance USE Felt 
     geometry Cylinder { 
     radius .5 
     height .6 
     } 
     } 
    ] 
    } 
    ] 
}# end Hat 
DEF Arm1 Transform { 
    children [ 
    DEF Arm Shape { 
     appearance DEF Stick Appearance { 
      material Material { 
      diffuseColor .7 .6 .4 
      specularColor 1 1 0 
      shininess .2 
      ambientIntensity .1 
      } 
     } 
     geometry Extrusion { 
     creaseAngle 1.4 
     crossSection [ .1 0, 
        .071 -.07, 0 -.1 
         -.07 -.071, -.1 0, 
         -.071 .07, 0 .1   #18 
         .07 .071, .1 0, 
      ] 
     spine [.6 .35 0, 1.5 .2 0, 2 0 .5 ] 
     scale [ 1 1, .7 .7, .5 .5] 

     } 
    } 
    ] 
    } 

DEF Arm2 Transform { 
    children [ 
    Shape { 
     appearance USE Stick 
     geometry DEF Tipper Extrusion { 
     creaseAngle 1.4 
     crossSection [ .1 0, 
        .071 -.07, 0 -.1 
         -.07 -.071, -.1 0, 
         -.071 .07, 0 .1   #18 
         .07 .071, .1 0, 
      ] 
     spine [-.6 .35 0, -1.5 .2 0, -2 0 .5] 
     # spine [-.6 .35 0, -1.5 .8 0, -.65 1.4 0 ] 
     scale [ 1 1, .7 .7, .5 .5] 

     } 
    } 
    ] 
    } 


    ] 
} 

DEF Tick TimeSensor { 
    cycleInterval 15 
    loop TRUE 
    enabled FALSE 
    } 


DEF Lift CoordinateInterpolator { 
    key [0, .35, .45, .5, .65, .75, 1] 
    keyValue [-.6 .35 0, -1.5 .2 0, -2 0 .5, 

       -.6 .35 0, -1.5 .2 0, -2 0 .5, 

       -.6 .35 0, -1.5 .8 0, -.65 1.4 0 

       -.6 .35 0, -1.5 1 0, -1.4 1.9 0 

       -.6 .35 0, -1.5 .8 0, -.65 1.4 0 

       -.6 .35 0, -1.5 .2 0, -2 0 .5, 

       -.6 .35 0, -1.5 .2 0, -2 0 .5,     

       ] 
      } 

DEF Doff PositionInterpolator { 
    key [0, .45, .5, .65, 1] 
    keyValue [ 0 0 0, 0 0 0, -.6 .5 0, 0 0 0, 0 0 0 ] 
    } 

ROUTE See.isActive TO Tick.set_enabled     
ROUTE Tick.fraction_changed TO Lift.set_fraction 
ROUTE Lift.value_changed TO Tipper.set_spine 
ROUTE Tick.fraction_changed TO Doff.set_fraction 
ROUTE Doff.value_changed TO Hat.set_translation 

WorldInfo { 
    title "Arcadia" 
    info [ "(C)1997 modeled by Kiwano (Andrew Reitemeyer) [email protected]"] 

      } 

我不能告訴部分的代碼之間的區別[2],並在部分[3 ]。任何人都可以幫忙嗎?提前致謝。

回答

0

嘛,一個是消防栓,另一種是跳舞雪人,這是最主要的區別;)

在[2]開關節點的「whichChoice」是-1,這使得它什麼都不顯示。嘗試將其更改爲0以顯示第一個孩子。或者消除它,我不認爲你需要它。