gltf and rest3d
DESCRIPTION
glTF and rest3d. Patrick Cozzi University of Pennsylvania CIS 565 - Fall 2013. Agenda. Asset Formats Tool, interchange, and runtime formats glTF Content Pipeline rest3d. Asset Formats. Native Modeling Tool Formats. .blend. .ma / . mb. .lxo. Examples. Interchange Formats. .fbx - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/1.jpg)
glTF and rest3d
Patrick CozziUniversity of PennsylvaniaCIS 565 - Fall 2013
![Page 2: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/2.jpg)
Agenda
Asset FormatsTool, interchange, and runtime formats
glTF Content Pipeline rest3d
2
![Page 3: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/3.jpg)
AssetFormats
3
![Page 4: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/4.jpg)
Native Modeling Tool Formats
Examples
4
.lxo.blend .ma / .mb
![Page 5: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/5.jpg)
Interchange Formats
5…
.fbx
.obj …
![Page 6: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/6.jpg)
Interchange Formats
6
.fbx
Engine(Runtime)
.obj
??
![Page 7: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/7.jpg)
Interchange Formats
Target tools, not the GPU, OpenGL, or Direct3D Example: COLLADA
XML + image files One index per attribute, not vertex Unsigned int indices Transform stack per node Polygons and splines Common profile materials Doesn’t specify image file format Lots of flexibility and indirection in animations and skins
7
![Page 8: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/8.jpg)
Runtime Format
Optimized for use in an engine
8
Interchange format
Toolformat
Content Pipeline Runtimeformat
Engine
![Page 9: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/9.jpg)
Engines
Engines are more than the runtime Example:
9
RuntimeC++
EditorC#
PipelineC++
Ships with the game
Used by developers, artists, etc.
“Tools”
“Engine”
![Page 10: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/10.jpg)
Engine Examples
Unity (November 2013)
Runtime: ~500K lines of codeTools: ~500K
Frostbite (November 2013)
Engine + Pipeline: 1.7MEditor: 1.1M
10
![Page 11: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/11.jpg)
glTF
11
![Page 12: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/12.jpg)
glTF
“the runtime asset format for WebGL, OpenGL ES, and OpenGL”
jpg, mp3, mpeg, … what about 3D? Open standard Not ratified yet
12
![Page 13: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/13.jpg)
glTF Goals
Easy and efficient to render
13
.json
Node hierarchy, materials, lights, cameras
.bin
• Geometry: vertices and indices
• Animation: key-frames• Skins: inverse-bind matrices
.glsl
Shaders
.png, .jpg, …
Textures
![Page 14: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/14.jpg)
glTF Goals
Balanced Feature Set
Extensible
14
< <
![Page 15: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/15.jpg)
glTF Goals
Code, Not Just SpecContent Pipeline is key to adoptionThree.js is key to adoption Implementations are needed for a sane spec
15
![Page 16: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/16.jpg)
glTF Goals
CommunityGrassroots and transparency
16
https://github.com/KhronosGroup/glTF
![Page 17: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/17.jpg)
glTF Goals
WebGL, OpenGL ES, and OpenGL Initial adoption - WebGL
17
![Page 18: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/18.jpg)
glTF Schema
18
scene
node
camera mesh light
accessor
bufferView
buffer
material
technique texture
samplerimageprogram
shader
1
2
1 11
1 *
**
*1
1
*
*
*animation
skin*
1
glTF duckexample
![Page 19: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/19.jpg)
Content Pipeline
19
![Page 20: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/20.jpg)
Content Pipeline
Optimize and package assets for use with the engine
Several areasGeometryAnimation and skinsTextureShaders
20
![Page 21: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/21.jpg)
Content Pipeline
Cleanup redundancies created by artist/exportersRemove unused nodes, meshes, materials,
techniques, etc.Remove unused vertices. Remove duplicate
verticesRemove duplicate materials and techniquesCombine primitives with the same material
and vertex format21
![Page 22: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/22.jpg)
Content Pipeline: Geometry
TriangulationPolygons TrianglesHigher-order surfaces
22
![Page 23: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/23.jpg)
Content Pipeline: Geometry
DeindexOne index per attribute
one index per vertex
23
positions
normals
position indices: [0, 1, 2, 0, 2, 3]
normal indices: [0, 0, 0, 0, 0, 0]
positions
normals
indices: [0, 1, 2, 0, 2, 3]
![Page 24: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/24.jpg)
Content Pipeline: Geometry
Flatten node hierarchy
24
![Page 25: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/25.jpg)
vertices ... ...
Content Pipeline: Geometry
Split meshesSo indices fit into unsigned short
25
indices: [0, 1, 2, ..., 64K - 3, 64K - 2, 64K - 1, 3, 4, 5, 64K, 64K + 1, 64K + 2, ...]
vertices ...
vertices ...
indices: [0, 1, 2, ..., 64K - 3, 64K - 2, 64K - 1, 3, 4, 5, ...]
indices: [0, 1, 2, ...]
![Page 26: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/26.jpg)
Content Pipeline: Geometry
CompressionOpen3DGC (TFAN)Pre-gzip for web deploymentEasy tricks
Minify JSON, e.g., whitespace Exclude default values, e.g., identity matrix Uniform scale instead of non-uniform scale 4x3 matrices instead of 4x4 Quaternions are normalized, only store 3 components
26
![Page 27: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/27.jpg)
27
![Page 28: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/28.jpg)
Content Pipeline: Geometry
Generate LODs
![Page 29: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/29.jpg)
Content Pipeline: Geometry
OthersConsistent up axis
What’s up? y? z? What’s forward?Re-order for the pre- and post-vertex-shader
caches Interleave vertex attributes?
![Page 30: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/30.jpg)
Content Pipeline: Animation and Skins
AnimationsResample key-framesCompress like geometry
SkinsLimit joints affecting a vertexSplit meshes
30
![Page 31: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/31.jpg)
Content Pipeline: Texture
Create texture atlas Increases batch size. Reduces individual files
31
![Page 32: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/32.jpg)
Content Pipeline: Texture
Generate mipmapsHigher quality than doing it online Increase size by 1/3
32
![Page 33: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/33.jpg)
Content Pipeline: Texture
Convert image formatsFor example, .bmp to .jpg
Compress imagesDXT / S3TCETC2
33
![Page 34: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/34.jpg)
Content Pipeline: Shaders
Generate shadersCommon profile -> GLSLg-buffer formats
34
![Page 35: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/35.jpg)
Content Pipeline: Shaders
Optimize shadersMinify too?
35
![Page 36: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/36.jpg)
Content Pipeline
Where is the parallelism?
36
![Page 37: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/37.jpg)
rest3d
37
![Page 38: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/38.jpg)
rest3d
Content Pipeline meets the cloud
38
rest3d
Manage and process
Modeling Tools Engines
![Page 39: glTF and rest3d](https://reader033.vdocuments.site/reader033/viewer/2022061610/56816934550346895de088d4/html5/thumbnails/39.jpg)
Closing
glTF properties not covered todayMorph targetsMultipassCube maps, mipmapsLights, cameras
ThemesKeep the runtime simplePush work to the Content Pipeline
39