0

我目前正在使用 Artoolkit(让程序员轻松开发增强现实应用程序的 C 和 C++ 语言软件库)和 Maya2013 开展一个项目。我想知道是否有人成功地从 Maya 导出了 VRML 文件并将其显示在artoolkit中。wrl 文件可以在 cosmoplayer 中查看,但它们不能很好地与artoolkit 一起使用。

[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] kiwano@t-online.de "
          "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) kiwano@t-online.de"]

          }

我无法区分第 [2] 部分中的代码和第 [3] 部分中的代码。有人可以帮忙吗?提前致谢。

4

1 回答 1

0

好吧,一个是消火栓,另一个是跳舞的雪人,这是主要区别;)

在 [2] 中,切换节点的“whichChoice”是 -1,这使它什么也不显示。尝试将其更改为 0 以显示第一个孩子。或者消除它,我认为你不需要它。

于 2012-08-22T06:52:35.073 回答