-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from mlimper/header-preamble-naming
[binary_glTF] First Version
- Loading branch information
Showing
35 changed files
with
169,623 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
}, | ||
"minItems" : 3, | ||
"maxItems" : 3 | ||
}, | ||
} | ||
}, | ||
"additionalProperties" : false | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
extensions/EXT_binary_glTF/BenchData/100kTris/100kTris.dae
Large diffs are not rendered by default.
Oops, something went wrong.
163,914 changes: 163,914 additions & 0 deletions
163,914
extensions/EXT_binary_glTF/BenchData/BinaryTree/BinaryTree.dae
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
333 changes: 333 additions & 0 deletions
333
extensions/EXT_binary_glTF/BenchData/Cesium_Air/Cesium_Air.dae
Large diffs are not rendered by default.
Oops, something went wrong.
126 changes: 126 additions & 0 deletions
126
extensions/EXT_binary_glTF/BenchData/LargeTex/LargeTex.dae
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1"> | ||
<asset> | ||
<contributor> | ||
<author>Blender User</author> | ||
<authoring_tool>Blender 2.74.0 commit date:2015-03-31, commit time:13:39, hash:000dfc0</authoring_tool> | ||
</contributor> | ||
<created>2015-05-27T11:34:50</created> | ||
<modified>2015-05-27T11:34:50</modified> | ||
<unit name="meter" meter="1"/> | ||
<up_axis>Z_UP</up_axis> | ||
</asset> | ||
<library_images> | ||
<image id="lightmap" name="lightmap"> | ||
<init_from>lightmap.png</init_from> | ||
</image> | ||
</library_images> | ||
<library_effects> | ||
<effect id="Material-effect"> | ||
<profile_COMMON> | ||
<newparam sid="lightmap-surface"> | ||
<surface type="2D"> | ||
<init_from>lightmap</init_from> | ||
</surface> | ||
</newparam> | ||
<newparam sid="lightmap-sampler"> | ||
<sampler2D> | ||
<source>lightmap-surface</source> | ||
</sampler2D> | ||
</newparam> | ||
<technique sid="common"> | ||
<phong> | ||
<emission> | ||
<color sid="emission">0 0 0 1</color> | ||
</emission> | ||
<ambient> | ||
<color sid="ambient">0 0 0 1</color> | ||
</ambient> | ||
<diffuse> | ||
<texture texture="lightmap-sampler" texcoord="UVMap"/> | ||
</diffuse> | ||
<specular> | ||
<color sid="specular">0.5 0.5 0.5 1</color> | ||
</specular> | ||
<shininess> | ||
<float sid="shininess">50</float> | ||
</shininess> | ||
<index_of_refraction> | ||
<float sid="index_of_refraction">1</float> | ||
</index_of_refraction> | ||
</phong> | ||
</technique> | ||
</profile_COMMON> | ||
</effect> | ||
</library_effects> | ||
<library_materials> | ||
<material id="Material-material" name="Material"> | ||
<instance_effect url="#Material-effect"/> | ||
</material> | ||
</library_materials> | ||
<library_geometries> | ||
<geometry id="Cube-mesh" name="Cube"> | ||
<mesh> | ||
<source id="Cube-mesh-positions"> | ||
<float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array> | ||
<technique_common> | ||
<accessor source="#Cube-mesh-positions-array" count="8" stride="3"> | ||
<param name="X" type="float"/> | ||
<param name="Y" type="float"/> | ||
<param name="Z" type="float"/> | ||
</accessor> | ||
</technique_common> | ||
</source> | ||
<source id="Cube-mesh-normals"> | ||
<float_array id="Cube-mesh-normals-array" count="36">0 0 -1 0 0 1 1 -5.66244e-7 3.27825e-7 -4.76837e-7 -1 0 -1 2.08616e-7 -1.19209e-7 2.08616e-7 1 1.78814e-7 0 0 -1 0 0 1 1 0 -2.38419e-7 0 -1 -2.98023e-7 -1 2.38419e-7 -1.49012e-7 2.68221e-7 1 2.38419e-7</float_array> | ||
<technique_common> | ||
<accessor source="#Cube-mesh-normals-array" count="12" stride="3"> | ||
<param name="X" type="float"/> | ||
<param name="Y" type="float"/> | ||
<param name="Z" type="float"/> | ||
</accessor> | ||
</technique_common> | ||
</source> | ||
<source id="Cube-mesh-map-0"> | ||
<float_array id="Cube-mesh-map-0-array" count="72">0.998999 0.001001 0.6676677 0.001001 0.6676677 0.3323323 0.001001 0.001001 0.001001 0.3323323 0.3323323 0.3323323 0.001001 0.3343343 0.001001 0.6656657 0.3323323 0.6656657 0.3343343 0.001001 0.3343343 0.3323323 0.6656657 0.3323323 0.6656657 0.3343343 0.3343343 0.3343343 0.3343343 0.6656657 0.001001 0.6676677 0.001001 0.998999 0.3323323 0.998999 0.998999 0.3323323 0.998999 0.001001 0.6676677 0.3323323 0.3323323 0.001001 0.001001 0.001001 0.3323323 0.3323323 0.3323323 0.3343343 0.001001 0.3343343 0.3323323 0.6656657 0.6656657 0.001001 0.3343343 0.001001 0.6656657 0.3323323 0.6656657 0.6656657 0.6656657 0.3343343 0.3343343 0.6656657 0.3323323 0.6676677 0.001001 0.6676677 0.3323323 0.998999</float_array> | ||
<technique_common> | ||
<accessor source="#Cube-mesh-map-0-array" count="36" stride="2"> | ||
<param name="S" type="float"/> | ||
<param name="T" type="float"/> | ||
</accessor> | ||
</technique_common> | ||
</source> | ||
<vertices id="Cube-mesh-vertices"> | ||
<input semantic="POSITION" source="#Cube-mesh-positions"/> | ||
</vertices> | ||
<polylist material="Material-material" count="12"> | ||
<input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/> | ||
<input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/> | ||
<input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/> | ||
<vcount>3 3 3 3 3 3 3 3 3 3 3 3 </vcount> | ||
<p>0 0 0 1 0 1 2 0 2 7 1 3 6 1 4 5 1 5 4 2 6 5 2 7 1 2 8 5 3 9 6 3 10 2 3 11 2 4 12 6 4 13 7 4 14 0 5 15 3 5 16 7 5 17 3 6 18 0 6 19 2 6 20 4 7 21 7 7 22 5 7 23 0 8 24 4 8 25 1 8 26 1 9 27 5 9 28 2 9 29 3 10 30 2 10 31 7 10 32 4 11 33 0 11 34 7 11 35</p> | ||
</polylist> | ||
</mesh> | ||
</geometry> | ||
</library_geometries> | ||
<library_controllers/> | ||
<library_visual_scenes> | ||
<visual_scene id="Scene" name="Scene"> | ||
<node id="Cube" name="Cube" type="NODE"> | ||
<matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix> | ||
<instance_geometry url="#Cube-mesh"> | ||
<bind_material> | ||
<technique_common> | ||
<instance_material symbol="Material-material" target="#Material-material"> | ||
<bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/> | ||
</instance_material> | ||
</technique_common> | ||
</bind_material> | ||
</instance_geometry> | ||
</node> | ||
</visual_scene> | ||
</library_visual_scenes> | ||
<scene> | ||
<instance_visual_scene url="#Scene"/> | ||
</scene> | ||
</COLLADA> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# Benchmarking Procedure | ||
|
||
Each `BenchData` directory contains a COLLADA `.dae` file. Each of these was converted to several different glTF formats (below). All files except for stand-alone textures were pre-gzipped, and the resulting files were served using `Content-Encoding: gzip`. | ||
|
||
* glTF, all resources separate | ||
* glTF, textures separate, other resources embedded (as data uri) | ||
* glTF, all resources embedded (as data uri) | ||
* Binary glTF, textures separate, other resources embedded (as binary) | ||
* Binary glTF, all resources embedded (as binary) | ||
|
||
Finally, these files were loaded and timed in Cesium 1.11 using the HelloWorld minimal Cesium application, with the code in Listing A1. | ||
All data and applications were served locally. | ||
Tests were run in Google Chrome 43.0, using device emulation at 1920x1080 with WiFi network emulation (30 Mbps 2ms RTT). | ||
Each test was run 5 times, and the mean of the results for each test is reported. | ||
|
||
## Detailed results | ||
|
||
| Model | Model | Format | Load time | Size (gzip\*) | # files | | ||
| ------------ | ---------------- | --------------------------- | ---------- | ------------- | ------- | | ||
| Cesium_Air | Cesium Air | ![](thumb/Cesium_Air.jpg) | | | | | ||
| | | gltf, separate | 0.32 s | 538 KiB | 8 | | ||
| | | gltf, tex-separate | **0.30 s** | 559 KiB | 3 | | ||
| | | gltf, all-embedded | 0.41 s | 540 KiB | **1** | | ||
| | | bgltf, tex-separate | **0.30 s** | 538 KiB | 3 | | ||
| | | bgltf, all-embedded | **0.29 s** | **513 KiB** | **1** | | ||
| LargeTex | Large Tex | ![](thumb/LargeTex.jpg) | | | | | ||
| | | gltf, separate | 3.07 s | 8.48 MiB | 5 | | ||
| | | gltf, tex-separate | 3.08 s | 8.48 MiB | 2 | | ||
| | | gltf, all-embedded | 4.62 s | 8.41 MiB | **1** | | ||
| | | bgltf, tex-separate | **3.04 s** | 8.48 MiB | 2 | | ||
| | | bgltf, all-embedded | **3.05 s** | **8.31 MiB** | **1** | | ||
| TenTex | Ten Tex | ![](thumb/TenTex.jpg) | | | | | ||
| | | gltf, separate | 1.58 s | 4.91 MiB | 16 | | ||
| | | gltf, tex-separate | **1.48 s** | 4.91 MiB | 11 | | ||
| | | gltf, all-embedded | 2.48 s | 4.95 MiB | **1** | | ||
| | | bgltf, tex-separate | **1.51 s** | 4.91 MiB | 11 | | ||
| | | bgltf, all-embedded | 1.63 s | **4.90 MiB** | **1** | | ||
| 100kTris | 100k Tris | ![](thumb/100kTris.jpg) | | | | | ||
| | | gltf, separate | 0.97 s | **2.98 MiB** | 4 | | ||
| | | gltf, tex-separate | 1.39 s | 3.25 MiB | **1** | | ||
| | | gltf, all-embedded | ^ | ^ | **^** | | ||
| | | bgltf, tex-separate | **0.91 s** | **2.98 MiB** | **1** | | ||
| | | bgltf, all-embedded | **^** | **^** | **^** | | ||
| BinaryTree | Binary Tree | ![](thumb/BinaryTree.jpg) | | | | | ||
| | | gltf, separate | **0.70 s** | **184 KiB** | 4 | | ||
| | | gltf, tex-separate | 0.87 s | **184 KiB** | **1** | | ||
| | | gltf, all-embedded | ^ | **^** | **^** | | ||
| | | bgltf, tex-separate | **0.69 s** | **184 KiB** | **1** | | ||
| | | bgltf, all-embedded | **^** | **^** | **^** | | ||
| SpinningTree | Spinning Tree | ![](thumb/SpinningTree.jpg) | | | | | ||
| | | gltf, separate | 0.64 s | **1.24 MiB** | 4 | | ||
| | | gltf, tex-separate | 0.73 s | 1.34 MiB | **1** | | ||
| | | gltf, all-embedded | ^ | ^ | **^** | | ||
| | | bgltf, tex-separate | **0.59 s** | **1.24 MiB** | **1** | | ||
| | | bgltf, all-embedded | **^** | **^** | **^** | | ||
| 1200_12th | 1200 12th Ave | ![](thumb/1200_12th.jpg) | | | | | ||
| | | gltf, separate | **0.85 s** | 1.25 MiB | 31 | | ||
| | | gltf, tex-separate | 0.87 s | 1.31 MiB | 22 | | ||
| | | gltf, all-embedded | 1.25 s | 1.30 MiB | **1** | | ||
| | | bgltf, tex-separate | **0.84 s** | 1.25 MiB | 22 | | ||
| | | bgltf, all-embedded | 1.02 s | **1.23 MiB** | **1** | | ||
| EauClaire | Eau Claire Tower | ![](thumb/EauClaire.jpg) | | | | | ||
| | | gltf, separate | 0.55 s | 609 KiB | 23 | | ||
| | | gltf, tex-separate | **0.52 s** | 610 KiB | 16 | | ||
| | | gltf, all-embedded | 0.66 s | 539 KiB | **1** | | ||
| | | bgltf, tex-separate | **0.53 s** | 608 KiB | 16 | | ||
| | | bgltf, all-embedded | 0.56 s | **538 KiB** | **1** | | ||
|
||
^ Results are excluded for "embedded" for files with no textures, as this is exactly the same as "tex-separate". | ||
|
||
\* All files compressed except for stand-alone texture files. | ||
|
||
### Benchmarked formats | ||
|
||
All files except for stand-alone textures are always pre-gzipped. | ||
|
||
| Format | Description | | ||
| :----------- | :----------------------------------------------- | | ||
| gltf | Standard glTF | | ||
| bgltf | Binary glTF | | ||
| separate | all resources as separate files | | ||
| tex-separate | only textures as separate files, others embedded | | ||
| all-embedded | all resources embedded | | ||
|
||
For standard glTF, files are embedded as base64-encoded data uris. | ||
For binary glTF, files are embedded as binary. | ||
|
||
### Model statistics | ||
|
||
These statistics are for the optimized models which are then converted to the various glTF formats. | ||
|
||
| Model | Type | Images | Draw calls | Tris, rendered | Tris, stored | Nodes | Meshes | Materials | Animations | | ||
| :--------------- | :-------------------------- | -----: | ---------: | -------------: | -----------: | ----: | -----: | --------: | ---------: | | ||
| Cesium Air | Typical model | 2 | 5 | 5,984 | ~5,984 | 7 | 2 | 2 | 2 | | ||
| LargeTex | Large texture | 1 | 1 | 12 | 12 | 2 | 1 | 1 | 0 | | ||
| TenTex | Multiple textures | 10 | 10 | 20 | 20 | 11 | 10 | 10 | 0 | | ||
| 100kTris | Many triangles | 0 | 5 | 99,372 | 99,372 | 2 | 5 | 1 | 0 | | ||
| BinaryTree | Many objects | 0 | 8191 | 98,292 | 12 | 8,192 | 1 | 1 | 0 | | ||
| SpinningTree | Many animations & keyframes | 0 | 31 | 372 | 12 | 32 | 1 | 1 | 93 | | ||
| 1200 12th Ave | Building data, complex | 21 | 3827 | 30,235 | | 17 | 1,197 | 26 | 0 | | ||
| Eau Claire Tower | Building data, simpler | 15 | 61 | 387 | | 45 | 47 | 17 | 0 | | ||
|
||
### Appendix | ||
|
||
**Listing A1**: Code used for benchmarking. | ||
```javascript | ||
// Add to HelloWorld.html. | ||
var viewer = new Cesium.Viewer('cesiumContainer', {globe: false, skyBox: false, skyAtmosphere: false}); | ||
var scene = viewer.scene; | ||
|
||
var timeModelLoad = function(url) { | ||
var origin = Cesium.Cartesian3.fromDegrees(0.0, 0.0, 0.0); | ||
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, 0.0, 0.0, 0.0); | ||
|
||
var timings = []; | ||
|
||
var f = function() { | ||
var t0 = performance.now(); | ||
var model = scene.primitives.add(Cesium.Model.fromGltf({ | ||
url : url, | ||
modelMatrix : modelMatrix, | ||
asynchronous : true, | ||
minimumPixelSize : 128 | ||
})); | ||
|
||
model.readyPromise.then(function(model) { | ||
var t1 = performance.now(); | ||
console.log(t1 - t0); | ||
model.activeAnimations.addAll({ | ||
loop : Cesium.ModelAnimationLoop.REPEAT | ||
}); | ||
}); | ||
}; | ||
|
||
f(); | ||
}; | ||
|
||
timeModelLoad('/BenchData/Cesium_Air/fmt/CesiumAir.gltf'); | ||
``` | ||
|
||
```javascript | ||
// Add to server.js when using Node.js. | ||
app.get('*.bin' , function(req, res, next) { res.header('Content-Encoding', 'gzip'); next(); }); | ||
app.get('*.glsl' , function(req, res, next) { res.header('Content-Encoding', 'gzip'); next(); }); | ||
app.get('*.gltf' , function(req, res, next) { res.header('Content-Encoding', 'gzip'); next(); }); | ||
app.get('*.bin' , function(req, res, next) { res.header('Content-Encoding', 'gzip'); next(); }); | ||
app.get('*.bgltf', function(req, res, next) { res.header('Content-Encoding', 'gzip'); next(); }); | ||
``` | ||
|
||
### References | ||
|
||
[1] Models provided by Cube Cities. |
3,496 changes: 3,496 additions & 0 deletions
3,496
extensions/EXT_binary_glTF/BenchData/SpinningTree/SpinningTree.dae
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.