当前位置:网站首页>Draco - gltf model compression tool

Draco - gltf model compression tool

2022-07-07 02:24:00 Brain in new VAT

Draco It is used for mesh compression glTF Extension and by Google Open source library developed , Used for compression and decompression 3D Mesh to significantly reduce 3D The size of the content . It compresses vertex positions 、 normal 、 Color 、 Texture coordinates and any other common vertex attributes , So as to improve the transmission on the network 3D Efficiency and speed of content .
 Insert picture description here

It means Smaller file size and Faster streaming , Especially in 3D Tiles Under the circumstances , When a new block appears or a new level of detail is required , It often streams new glTF Model .

We've been working with Khronos and Google Cooperative make Draco Become glTF Expand , You can be in now Cesium Load in Draco Compression model and 3D Tile set !

2、Khronos glTF Draco Compression expansion

glTF Now there is KHR_draco_mesh_compression Expand , It can be loaded with Draco Buffer of compressed geometry . from Cesium 1.44 Start , We use Google The open source JavaScript The decompression library supports the use of Draco Compressed data loading glTF assets .

Using compressed meshes can reduce glTF The final file size of the model , This means that these assets take up less space , Download less data , Streaming is faster . To illustrate the difference , We use Draco The encoder compresses the following files , The default compression level for all attributes is 7.

This is a glTF 2.0 Draco Compress Cesium Milk truck example model And glTF 2.0 Cesium Comparison of milk truck example models , Both contain textures and animations .

Draco Compress non-compressed file
2.1 KB2.2 KBCesiumMilkTruck.gltf
14.0 KB107 KB0.bin
418 KB418 KBCesiumMilkTruck.png

 Insert picture description here

Since this extension only compresses geometry , So texture payload (CesiumMilkTruck.png) Keep the same size (418 KB). Extra created with extensions JSON Metadata for .gltf Files have little impact (2.1 KB And 2.2 KB).

Next , Here is glTF 2.0 Draco Compressed Buggy Example model And glTF 2.0 Buggy Comparison of example models , The latter is a mesh with more complex geometry .

Draco Compress non-compressed
824 KB391 KB Off-road vehicle .gltf
0.824 MB7.6 MBBuggy0.bin

 Insert picture description here

We see a smaller .gltf file (824 KB Yes 391 KB), Because each primitive needs to be specified JSON Less metadata , And a significantly smaller .bin file , Because you can use extensions to compress a lot of geometry .

3、Cesium 3D Tiles

Use 3D Tiles when ,Cesium Often send requests and stream new 3D Content . Now you can use Draco Expand and compress the glTF Content , And use less data to stream faster . below , We use glTF 2.0 Processed 12.8 GB Of City GML data , It includes 110 Ten thousand New York City buildings ,Draco The compression level is 5.

Total tile set size
belt Gzip Compression of the glTF2.0
with Draco Compression of the glTF 2.0179 MB
with Draco and Gzip Compression of the glTF 2.0149 MB

In terms of loading time , Although we are performing loading and compiling Draco modular Web The overhead of the assembly is subject to a small initial impact , But after that, the streaming and decompression speed of all slices are faster than none Draco Faster compression . This is used only gzip Compression of the glTF 2.0 And use Draco Compression and gzip Of glTF 2.0 Comparison of the lumped loading time of tiles .*

 Insert picture description here

glTF 2.0( Compressed package ) with Draco Compression of the glTF 2.0 (gzipped)
Tile set size :738 MB Tile set size :149 MB
Loading time :18.921 second Loading time :10.548 second

* Image with 2 Times the speed to demonstrate .

4、 performance optimization

Cesium Of Draco The decoding implementation utilizes Web Assembly Asynchronous decoding and GPU De quantification on , This means decoding multiple models in parallel ( Or part of the model ), And use less overall memory .

 Insert picture description here

5、 Parallel decompression

Cesium utilize Web Workers Decode multiple meshes in parallel . stay 3D Tiles Under the circumstances , This means that multiple can be streamed and decoded at the same time Tile. Besides , Every element of the grid ( Or part of it ) Can be decoded separately , In order to decode complex models faster . Before returning the data needed to render the mesh to the main thread , We can retrieve each segment of the encoding buffer and pass the data to a separate worker for parallel asynchronous decoding .

When the browser supports , We load and compile the decoding module Web Assembly Binary files and shared among multiple staff , With the use of pure JavaScript Solution compared to , Further improve the compression speed .

6、GPU De quantification on

Cesium still GPU Decode some attributes on , Decode outside the main thread and use less memory . Usually stored as 32 Vertex attribute of bit floating-point number , For example, location attribute data , It can be decoded into quantized 16 Bit integer value . Besides , For unit vector attributes like normals , We can decode it into Octal code data .

stay GPU When decoding on , We skip Draco Quantization or octahedral transformation operation in decoder module , Instead, retrieve and store any transformation constants . Smaller decoded data can be passed to GPU, Perform dequantization or octal decoding operations in shaders at render time . This leads to CPU The main application thread running on and GPU Running in parallel on requires less memory .

When using the previously mentioned New York City 3D Tiles gather GPU When performing inverse quantization in ,GPU The memory used is saved 52%, There is no difference in file size , There is no difference in visual quality , And it has no effect on the total loading time of the tile set , Because with full use Draco The decoding module decodes and compares .

Draco Compress stay GPU Using inverse quantization compression Draco
memory 119MB57MB
Tile set loading time 7.45 second 7.44 second

Link to the original text : use Draco Compress 3D Model — BimAnt

原网站

版权声明
本文为[Brain in new VAT]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207061837149598.html

随机推荐