2012-08-06 105 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以显示第一个孩子。或者消除它,我不认为你需要它。