DAE(Digital Asset Exchange)文件格式是3D交互文件格式,一般用于多个图形程序之间交换数字数据,

DAE是一种3D模型,可被flash 导入。3Dmax与maya需要安装dae输出插件才可以打开,输出成后缀为dae的文件。谷歌地球的模型就是DAE。

DAE文件是COLLADA的模型文件

COLLADA定义了XML命名空间和数据库模式,以便在不丢失信息的情况下轻松地在应用程序之间传输3D资产,从而将各种3D创作和处理工具组合到内容生成管道中。

COLLADA不是作为游戏引擎格式设计的; 它被设计为内容管道中所有工具的中间格式,例如DCC工具和调节器

结构

<?xml version="1.0"?>
<COLLADA
  xmlns="http://www.collada.org/2005/11/COLLADASchema"
  version="1.4.1"
>
    ...
</COLLADA>

内容

<asset/>
<library_cameras/>
<library_lights/>
<library_images/>
<library_materials/>
<library_effects/>
<library_geometries/>
<library_controllers/>
<library_visual_scenes/>
<scene/>
<extra/>

library类似于Flash中的库,以它开头的节点代表着几何体、材质、灯光等对象,下面是各节点对应的含义:
library_effects:特效
library_materials:材质
library_geometries:几何对象
library_lights:灯光
library_images:图片
library_visual_scenes:可视化场景
library_meshes:Mesh对象

如果模型带有动画的,还可能会有以下节点:
library_animations:动作
library_controllers:控制器

1.asset

描述作者和环境

<asset>
    <contributor>
      <author>Blender User</author>
      <authoring_tool>BIMobjectScriptDesignerColladaConverter</authoring_tool>
    </contributor>
    <created>2008-04-08T13:07:52-08:00</created>
    <modified>2008-04-08T13:07:52-08:00</modified>
    <unit meter="0.01" name="cm"/>
    <up_axis>Z_UP</up_axis>
</asset>

2.scene

场景标记指定一个可视场景,有时也指定一个物理场景

说明:

  许多元素包含“id =”属性,Collada使用“url =”属性来关联其他内部元素。

  这将在构建几何体时跟踪和替换id,在最终使用<scene>标记将文档绑定在一起,该结构使用了多个<library_X>标记

<scene>
    <instance_visual_scene url="#VisualSceneNode"/>
</scene>

3.visual scenes library

包含OpenGL属性的nodesribes层次结构

<library_visual_scenes>
    <visual_scene id="VisualSceneNode">
      <node id="View-Perspective" name="View-Perspective">
        <matrix>-0.197645 -0.302924 0.932295 1.789481 0.980274 -0.061076 0.187971 0.834212 0.000000 0.951056 0.309020 0.620575 0.000000 0.000000 0.000000 1.000000</matrix>
        <instance_camera url="#Camera-Perspective" />
      </node>
      ……
    </visual_scene>
</library_visual_scenes>

  物件的根节点是VisualSceneNode。

  node节点,node节点可以想象为物件的孩子,比如人的一部分手。

  matrix节点,位置、旋转属性,是一个16个数据的字符串,其实就是一个Matrix3D。

4.camera library

<library_cameras>
    <camera id="PerspCamera" name="PerspCamera">
      <optics>
        <technique_common>
          <perspective>
            <yfov>37.8493</yfov>
            <aspect_ratio>1</aspect_ratio>
            <znear>10</znear>
            <zfar>1000</zfar>
          </perspective>
        </technique_common>
      </optics>
    </camera>
</library_cameras>

5.lights library

常见的灯有点、点或方向灯

<library_lights>
    <light id="pointLightShape1-lib" name="pointLightShape1">
      <technique_common>
        <point>
          <color>1 1 1 </color>
          <constant_attenuation>1</constant_attenuation>
          <linear_attenuation>0</linear_attenuation>
          <quadratic_attenuation>0</quadratic_attenuation>
        </point>
      </technique_common>
    </light>
</library_lights>

6.images library

<library_images>
    <image id="ce_jpg" name="ce_jpg">
          <init_from>ce.jpg</init_from>
    </image>
</library_images>

7.materials library

<library_materials>
    <material id="Blue" name="Blue">
      <instance_effect url="#Blue-fx"/>
    </material>
</library_materials>

8.effects library

<library_effects>
    <effect id="Blue-fx">
      <profile_COMMON>
        <technique sid="common">
          <phong>
            <emission>
              <color>0 0 0 1 </color>
            </emission>
            ...
            <index_of_refraction>
              <float>0</float>
            </index_of_refraction>
          </phong>
        </technique>
      </profile_COMMON>
    </effect>
</library_effects>

9.geometries library

几何数据

<mesh>—— 网格

<source>——至少1到2个结点,它的意义决定于它的类型,它可以存储顶点、法线、纹理坐标等信息

<library_geometries>
    <geometry id="box-lib" name="box">
      <mesh>
        <source id="box-lib-positions" name="position">
        </source>
        <source id="box-lib-normals" name="normal">
        </source>
        ...
        <vertices id="box-lib-vertices">
          <input semantic="POSITION" source="#box-lib-positions"/>
        </vertices>
        <polylist count="6" material="BlueSG">
          <input offset="0" semantic="VERTEX" source="#box-lib-vertices"/>
          <input offset="1" semantic="NORMAL" source="#box-lib-normals"/>
          <vcount>4 4 4 4 4 4 </vcount>
          <p>0 0 2 1 3 2 1 3 0 4 1 5 5 6 4 7 ...</p>
        </polylist>
      </mesh>
    </geometry>
</library_geometries>

10.controllers library

 包含了整个模型中所有的关节各自所关联的顶点和关联的顶点的权值信息。

<library_controllers>
    <controller id="Armature_Stormtrooper-skin" name="Armature">
      <skin source="#Stormtroopermesh-mesh">
        <bind_shape_matrix>-1.662001 5.26272e-8 -1.23829e-8 3.40529e-8 -1.23829e-8 -1.0532e-8 -1.662 -1.23829e-8 -5.26272e-8 1.662 -2.91063e-8 -7.42972e-8 0 0 0 1</bind_shape_matrix>
        <source id="Armature_Stormtrooper-skin-joints">
          <Name_array id="Armature_Stormtrooper-skin-joints-array" count="52"> …… </Name_array>
          <technique_common>
            <accessor source="#Armature_Stormtrooper-skin-joints-array" count="52" stride="1">
              <param name="JOINT" type="name"/>
            </accessor>
          </technique_common>
        </source>
    ……
        <joints>
          <input semantic="JOINT" source="#Armature_Stormtrooper-skin-joints"/>
          <input semantic="INV_BIND_MATRIX" source="#Armature_Stormtrooper-skin-bind_poses"/>
        </joints>
        <vertex_weights count="3275">
          <input semantic="JOINT" source="#Armature_Stormtrooper-skin-joints" offset="0"/>
          <input semantic="WEIGHT" source="#Armature_Stormtrooper-skin-weights" offset="1"/>
          <vcount>……</v>
        </vertex_weights>
      </skin>
    </controller>
  </library_controllers>

  <library_controllers>下只有一个<controller>结点

  从<NAME_array>中读到的所有关节的名字实际上是前面<node>结点的SID

11.extra

extra是扩展格式的一种方式

<extra>
  <technique profile="steveT">
    <test_element id="my_test_element" attr1="value1" attr2="value2">
      this is some text
    </test_element>
  </technique>
</extra>

 说明:

  <library_geometries>的geometry里只有1个的<mesh>结点

  COLLADA里的几何图形是以三角形的方式记录的

     COLLADA中只支持骨骼动画,至少含有一个骨骼