[![Build Status](https://github.com/google/draco/workflows/Build/badge.svg)](https://github.com/google/draco/actions?query=workflow%3ABuild) News ======= ### Version 1.4.1 release * Using the versioned www.gstatic.com WASM and Javascript decoders is now recommended. To use v1.4.1, use this URL: * https://www.gstatic.com/draco/versioned/decoders/1.4.1/* * Replace the * with the files to load. E.g. * https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js * This works with the v1.3.6 and v1.4.0 releases, and will work with future Draco releases. * Bug fixes ### Version 1.4.0 release * WASM and JavaScript decoders are hosted from a static URL. * It is recommended to always pull your Draco WASM and JavaScript decoders from this URL: * https://www.gstatic.com/draco/v1/decoders/* * Replace * with the files to load. E.g. * https://www.gstatic.com/draco/v1/decoders/draco_decoder_gltf.wasm * Users will benefit from having the Draco decoder in cache as more sites start using the static URL * Changed npm modules to use WASM, which increased performance by ~200%. * Updated Emscripten to 2.0. * This causes the Draco codec modules to return a promise instead of the module directly. * Please see the example code on how to handle the promise. * Changed NORMAL quantization default to 8. * Added new array API to decoder and deprecated DecoderBuffer. * See PR https://github.com/google/draco/issues/513 for more information. * Changed WASM/JavaScript behavior of catching exceptions. * See issue https://github.com/google/draco/issues/629 for more information. * Code cleanup. * Emscripten builds now disable NODEJS_CATCH_EXIT and NODEJS_CATCH_REJECTION. * Authors of a CLI tool might want to add their own error handlers. * Added Maya plugin builds. * Unity plugin builds updated. * Builds are now stored as archives. * Added iOS build. * Unity users may want to look into https://github.com/atteneder/DracoUnity. * Bug fixes. ### Version 1.3.6 release * WASM and JavaScript decoders are now hosted from a static URL * It is recommended to always pull your Draco WASM and JavaScript decoders from this URL: * https://www.gstatic.com/draco/v1/decoders/* * Replace * with the files to load. E.g. * https://www.gstatic.com/draco/v1/decoders/draco_decoder_gltf.wasm * Users will benefit from having the Draco decoder in cache as more sites start using the static URL * Changed web examples to pull Draco decoders from static URL * Added new API to Draco WASM decoder, which increased performance by ~15% * Decreased Draco WASM decoder size by ~20% * Added support for generic and multiple attributes to Draco Unity plug-ins * Added new API to Draco Unity, which increased decoder performance by ~15% * Changed quantization defaults: * POSITION: 11 * NORMAL: 7 * TEX_COORD: 10 * COLOR: 8 * GENERIC: 8 * Code cleanup * Bug fixes ### Version 1.3.5 release * Added option to build Draco for Universal Scene Description * Code cleanup * Bug fixes ### Version 1.3.4 release * Released Draco Animation code * Fixes for Unity * Various file location and name changes ### Version 1.3.3 release * Added ExpertEncoder to the Javascript API * Allows developers to set quantization options per attribute id * Bug fixes ### Version 1.3.2 release * Bug fixes ### Version 1.3.1 release * Fix issue with multiple attributes when skipping an attribute transform ### Version 1.3.0 release * Improved kD-tree based point cloud encoding * Now applicable to point clouds with any number of attributes * Support for all integer attribute types and quantized floating point types * Improved mesh compression up to 10% (on average ~2%) * For meshes, the 1.3.0 bitstream is fully compatible with 1.2.x decoders * Improved Javascript API * Added support for all signed and unsigned integer types * Added support for point clouds to our Javascript encoder API * Added support for integer properties to the PLY decoder * Bug fixes ### Previous releases https://github.com/google/draco/releases Description =========== Draco is a library for compressing and decompressing 3D geometric [meshes] and [point clouds]. It is intended to improve the storage and transmission of 3D graphics. Draco was designed and built for compression efficiency and speed. The code supports compressing points, connectivity information, texture coordinates, color information, normals, and any other generic attributes associated with geometry. With Draco, applications using 3D graphics can be significantly smaller without compromising visual fidelity. For users, this means apps can now be downloaded faster, 3D graphics in the browser can load quicker, and VR and AR scenes can now be transmitted with a fraction of the bandwidth and rendered quickly. Draco is released as C++ source code that can be used to compress 3D graphics as well as C++ and Javascript decoders for the encoded data. _**Contents**_ * [Building](#building) * [Usage](#usage) * [Unity](#unity) * [WASM and JavaScript Decoders](#WASM-and-JavaScript-Decoders) * [Command Line Applications](#command-line-applications) * [Encoding Tool](#encoding-tool) * [Encoding Point Clouds](#encoding-point-clouds) * [Decoding Tool](#decoding-tool) * [C++ Decoder API](#c-decoder-api) * [Javascript Encoder API](#javascript-encoder-api) * [Javascript Decoder API](#javascript-decoder-api) * [Javascript Decoder Performance](#javascript-decoder-performance) * [Metadata API](#metadata-api) * [NPM Package](#npm-package) * [three.js Renderer Example](#threejs-renderer-example) * [Support](#support) * [License](#license) * [References](#references) Building ======== See [BUILDING](BUILDING.md) for building instructions. Usage ====== Unity ----- For the best information about using Unity with Draco please visit https://github.com/atteneder/DracoUnity For a simple example of using Unity with Draco see [README](unity/README.md) in the unity folder. WASM and JavaScript Decoders ---------------------------- It is recommended to always pull your Draco WASM and JavaScript decoders from: ~~~~~ bash https://www.gstatic.com/draco/v1/decoders/ ~~~~~ Users will benefit from having the Draco decoder in cache as more sites start using the static URL. Command Line Applications ------------------------ The default target created from the build files will be the `draco_encoder` and `draco_decoder` command line applications. For both applications, if you run them without any arguments or `-h`, the applications will output usage and options. Encoding Tool ------------- `draco_encoder` will read OBJ or PLY files as input, and output Draco-encoded files. We have included Stanford's [Bunny] mesh for testing. The basic command line looks like this: ~~~~~ bash ./draco_encoder -i testdata/bun_zipper.ply -o out.drc ~~~~~ A value of `0` for the quantization parameter will not perform any quantization on the specified attribute. Any value other than `0` will quantize the input values for the specified attribute to that number of bits. For example: ~~~~~ bash ./draco_encoder -i testdata/bun_zipper.ply -o out.drc -qp 14 ~~~~~ will quantize the positions to 14 bits (default is 11 for the position coordinates). In general, the more you quantize your attributes the better compression rate you will get. It is up to your project to decide how much deviation it will tolerate. In general, most projects can set quantization values of about `11` without any noticeable difference in quality. The compression level (`-cl`) parameter turns on/off different compression features. ~~~~~ bash ./draco_encoder -i testdata/bun_zipper.ply -o out.drc -cl 8 ~~~~~ In general, the highest setting, `10`, will have the most compression but worst decompression speed. `0` will have the least compression, but best decompression speed. The default setting is `7`. Encoding Point Clouds --------------------- You can encode point cloud data with `draco_encoder` by specifying the `-point_cloud` parameter. If you specify the `-point_cloud` parameter with a mesh input file, `draco_encoder` will ignore the connectivity data and encode the positions from the mesh file. ~~~~~ bash ./draco_encoder -point_cloud -i testdata/bun_zipper.ply -o out.drc ~~~~~ This command line will encode the mesh input as a point cloud, even though the input might not produce compression that is representative of other point clouds. Specifically, one can expect much better compression rates for larger and denser point clouds. Decoding Tool ------------- `draco_decoder` will read Draco files as input, and output OBJ or PLY files. The basic command line looks like this: ~~~~~ bash ./draco_decoder -i in.drc -o out.obj ~~~~~ C++ Decoder API ------------- If you'd like to add decoding to your applications you will need to include the `draco_dec` library. In order to use the Draco decoder you need to initialize a `DecoderBuffer` with the compressed data. Then call `DecodeMeshFromBuffer()` to return a decoded mesh object or call `DecodePointCloudFromBuffer()` to return a decoded `PointCloud` object. For example: ~~~~~ cpp draco::DecoderBuffer buffer; buffer.Init(data.data(), data.size()); const draco::EncodedGeometryType geom_type = draco::GetEncodedGeometryType(&buffer); if (geom_type == draco::TRIANGULAR_MESH) { unique_ptr