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中只支持骨骼動畫,至少含有一個骨骼