Difference between revisions of "CDN Progressive Format"

From Sirikata Wiki
Jump to navigation Jump to search
(Created page with "== ASCII == The ascii format is a series of lines. There are two types of progressive format updates: ===t=== Description: Add a triangle at the end of the triangle list. Format:...")
 
 
(6 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 vertex in an existing triangle.
+
Description: Update triangle index location ti to vertex index vi
 
Format:
 
Format:
  u tri_index vert_index
+
  u ti vi
  vx vy vz nx ny nz s t
+
 
 +
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
  
===Example===
 
u 1019 1
 
340.026 673.774 273.745 -0.129702 0.942153 0.309072 0.47658809643 0.622889051512
 
u 1018 2
 
340.026 673.774 273.745 -0.129702 0.942153 0.309072 0.47658809643 0.622889051512
 
u 1017 1
 
340.026 673.774 273.745 -0.129702 0.942153 0.309072 0.47658809643 0.622889051512
 
u 1016 2
 
340.026 673.774 273.745 -0.129702 0.942153 0.309072 0.47658809643 0.622889051512
 
t
 
297.959 661.148 284.938 -0.202967 0.908945 0.364176 0.746665141185 0.54192551248
 
340.026 673.774 273.745 -0.129702 0.942153 0.309072 0.47658809643 0.622889051512
 
332.844 676.673 253.65 -0.161151 0.972223 0.169743 0.71931608616 0.527522427365
 
 
== 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