Difference between revisions of "CDN Progressive Format"

From Sirikata Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
=PDAE (Progressive Digital Asset Exchange) File Format=
 +
==Notes about parsing base mesh==
 +
The progressive format assumes that the base mesh is parsed intelligently. COLLADA allows for different source arrays (vertex, normal, texture coordinate) to be indexed separately, but when sending to the graphics card, a single index must be give for each triangle's vertex. A naive implementation would just create a source array entry for every single vertex and then set the triangle indices to be from 1 to N*3 where N is the number of triangles. Instead, the progressive format assumes that a source array entry is only created for each unique set of vertex indices. Then, the vertex indices can be re-used when a vertex points to the same set of indices. The vertex indices in the progressive format assume that the uniqueness has been calculated starting from the beginning of the array. The triangle indices refer to the expanded triangle index, such that index i refers to the i/3 triangle and the i%3 vertex in that triangle.
 +
 
== ASCII ==
 
== ASCII ==
The ascii format is a series of lines. There are two types of progressive format updates:
+
The ASCII file format consists of the header, followed by a series of lines. The header contains the number of progressive refinements to follow in the file. Each progressive refinement contains the number of operations contained, followed by some number of "v", "u", and "t" lines. See below for description.
 +
===Header===
 +
* The string "PDAE" followed by a newline.
 +
* The number of progressive refinements, followed by a newline.
 +
===Progressive Refinement===
 +
Description: Contains the number of operations within the progressive refinement.
 +
Format:
 +
N
 +
 
 +
Example:
 +
7
 +
 
 +
===v===
 +
Description: Add a unique set of vertex information to the end of the vertex source array. v1-v3 is the vertex information (X,Y,Z), n1-3 is the normal information (X,Y,Z) and u-v is the texture coordinate (U,V)
 +
Format:
 +
v v1 v2 v3 n1 n2 n3 u v
 +
 
 +
Example:
 +
v 889.211 747.1346 292.3802 0.349573 0.870764 0.345787 0.7733477 0.4360528
 +
 
 
===t===
 
===t===
Description: Add a triangle at the end of the triangle list.
+
Description: Add a triangle at the end of the triangle list. i1-i3 are the index values indexing into the vertex source array.
 
Format:
 
Format:
  t
+
  t i1 i2 i3
v1x v1y v1z n1x n1y n1z s1 t1
+
 
  v2x v2y v2z n2x n2y n2z s2 t2
+
Example:
v3x v3y v3z n3x n3y n3z s3 t3
+
  t 1611 2348 1686
 +
 
 
===u===
 
===u===
Description: Update a set of triangle vertices to a new value.
+
Description: Update triangle index location ti to vertex index vi
 
Format:
 
Format:
  u tri_index1 vert_index1 [, tri_index2, vert_index2, ...]
+
  u ti vi
  vx vy vz nx ny nz s t
+
 
 +
Example:
 +
  u 3333 2351
  
===Example===
+
===PDAE Example===
  u 2113 2 2114 1 2099 1
+
  PDAE
  858.833 331.724 586.183 0.985137 -0.024169 -0.170059 0.622006839489 0.34562723709
+
  2
  t
+
  7
  856.92 338.534 593.997 0.998153 -0.023506 0.056019 0.718622982327 0.647501941654
+
  v 889.211 747.1346 292.3802 0.349573 0.870764 0.345787 0.7733477 0.4360528
  858.833 331.724 586.183 0.985137 -0.024169 -0.170059 0.622006839489 0.34562723709
+
  v 889.211 747.1346 292.3802 0.349573 0.870764 0.345787 0.9263274 0.4431856
  858.618 369.736 576.828 0.945305 0.008707 -0.32607 0.716357337334 0.626541803089
+
t 1611 2348 1686
  t
+
t 1656 2349 1682
851.767 321.741 574.435 0.893271 -0.118948 -0.433495 0.7370480058 0.632873228772
+
u 2717 2348
  858.618 369.736 576.828 0.945305 0.008707 -0.32607 0.716357337334 0.626541803089
+
u 2730 2349
  858.833 331.724 586.183 0.985137 -0.024169 -0.170059 0.622006839489 0.34562723709
+
  u 2656 2348
  u 1655 0 1707 2 1708 1 1717 0 2997 2
+
9
781.087 197.747 771.398 0.829927 -0.453996 0.324203 0.62944613018 0.623427561384
+
v 981.3076 765.1611 202.6041 0.321965 0.939617 -0.116016 0.7673832 0.4037398
  t
+
  v 981.3076 765.1611 202.6041 0.645074 0.228829 -0.729052 0.674786 0.442541
  781.087 197.747 771.398 0.829927 -0.453996 0.324203 0.62944613018 0.623427561384
+
  v 965.4113 724.5516 215.2124 0.650398 -0.741869 0.163133 0.6845703 0.4528548
  774.308 200.145 793.304 0.856872 -0.444391 0.261318 0.247125345149 0.00965406959324
+
  v 981.3076 765.1611 202.6041 0.950511 -0.146462 -0.274005 0.7673832 0.4037398
  757.977 182.093 803.837 0.661695 -0.670821 0.3349 0.237640010081 0.00189882818086
+
  v 965.4113 724.5516 215.2124 0.86448 -0.440579 -0.242001 0.7953826 0.4032472
 +
  t 2030 2351 2352
 +
  t 2353 1667 2354
 +
  u 2747 2350
 +
  u 3333 2351
  
 
== Binary ==
 
== Binary ==
 
To come
 
To come

Latest revision as of 15:58, 14 September 2011

PDAE (Progressive Digital Asset Exchange) File Format

Notes about parsing base mesh

The progressive format assumes that the base mesh is parsed intelligently. COLLADA allows for different source arrays (vertex, normal, texture coordinate) to be indexed separately, but when sending to the graphics card, a single index must be give for each triangle's vertex. A naive implementation would just create a source array entry for every single vertex and then set the triangle indices to be from 1 to N*3 where N is the number of triangles. Instead, the progressive format assumes that a source array entry is only created for each unique set of vertex indices. Then, the vertex indices can be re-used when a vertex points to the same set of indices. The vertex indices in the progressive format assume that the uniqueness has been calculated starting from the beginning of the array. The triangle indices refer to the expanded triangle index, such that index i refers to the i/3 triangle and the i%3 vertex in that triangle.

ASCII

The ASCII file format consists of the header, followed by a series of lines. The header contains the number of progressive refinements to follow in the file. Each progressive refinement contains the number of operations contained, followed by some number of "v", "u", and "t" lines. See below for description.

Header

  • The string "PDAE" followed by a newline.
  • The number of progressive refinements, followed by a newline.

Progressive Refinement

Description: Contains the number of operations within the progressive refinement. Format:

N

Example:

7

v

Description: Add a unique set of vertex information to the end of the vertex source array. v1-v3 is the vertex information (X,Y,Z), n1-3 is the normal information (X,Y,Z) and u-v is the texture coordinate (U,V) Format:

v v1 v2 v3 n1 n2 n3 u v

Example:

v 889.211 747.1346 292.3802 0.349573 0.870764 0.345787 0.7733477 0.4360528

t

Description: Add a triangle at the end of the triangle list. i1-i3 are the index values indexing into the vertex source array. Format:

t i1 i2 i3

Example:

t 1611 2348 1686

u

Description: Update triangle index location ti to vertex index vi Format:

u ti vi

Example:

u 3333 2351

PDAE Example

PDAE
2
7
v 889.211 747.1346 292.3802 0.349573 0.870764 0.345787 0.7733477 0.4360528
v 889.211 747.1346 292.3802 0.349573 0.870764 0.345787 0.9263274 0.4431856
t 1611 2348 1686
t 1656 2349 1682
u 2717 2348
u 2730 2349
u 2656 2348
9
v 981.3076 765.1611 202.6041 0.321965 0.939617 -0.116016 0.7673832 0.4037398
v 981.3076 765.1611 202.6041 0.645074 0.228829 -0.729052 0.674786 0.442541
v 965.4113 724.5516 215.2124 0.650398 -0.741869 0.163133 0.6845703 0.4528548
v 981.3076 765.1611 202.6041 0.950511 -0.146462 -0.274005 0.7673832 0.4037398
v 965.4113 724.5516 215.2124 0.86448 -0.440579 -0.242001 0.7953826 0.4032472
t 2030 2351 2352
t 2353 1667 2354
u 2747 2350
u 3333 2351

Binary

To come