Export guidelines
Learn how to export optimized models with the lightest file size using GLB, Draco and KTX2 compression.
Read time 7 minutesLast updated 8 months ago
Why focus on export file size?
After preparing, repairing, and optimizing your 3D models, the final step is exporting them in a format optimized for your target platform. Export file size directly impacts:
- Load times - Smaller files download and load faster, especially critical for web applications
- Bandwidth costs - Reduced file sizes lower hosting and transmission costs
- User experience - Faster initial loading improves perceived application performance
- Mobile support - Smaller files are essential for devices with limited bandwidth or storage
The GLB format with Draco compression provides the best combination of compatibility, file size reduction, and runtime performance for real-time applications.
1. Prepare your model for export
Before exporting, ensure your model has been properly optimized. The more you optimize before export, the lighter your final file will be.
Reduce polygon count
Lower polygon counts directly reduce file size. The mesh geometry data (vertices, normals, UVs) is typically the largest component of exported files.
Use decimation and occluded geometry removal to reduce triangle count while preserving visual quality.
Reduce the number of unique meshes
The number of unique meshes in your scene affects file size. Mesh data must be stored for each unique geometry.
Use instancing to reduce unique mesh count - Instancing is one of the most effective ways to reduce file size. When multiple objects share the same mesh (instances), only one copy of the mesh data needs to be stored in the exported file.
See the optimization guidelines for detailed information on polygon reduction and mesh optimization techniques.
2. Export to GLB format
The GLB (binary glTF) format is the recommended export format for real-time applications, especially web-based 3D experiences. GLB offers:
- Industry standard - Supported by all modern web browsers and 3D engines
- Efficient binary format - Geometry, textures, and animations in a single file
- Draco compression support - Built-in support for mesh compression
- PBR materials - Physical Based Rendering material support
- Animation support - Skeletal animations and morph targets
Basic GLB export
Use io.exportScene to export your optimized model to GLB format:
# Export the entire scene to GLBio.exportScene("output/optimized_model.glb")
3. Enable Draco compression
Draco compression is a mesh compression technology that dramatically reduces file size for GLB exports. Draco compresses vertex positions, normals, texture coordinates, and other mesh attributes.
How Draco compression works
Draco uses quantization and entropy coding to compress mesh data:
- Quantization - Reduces precision of vertex attributes (positions, normals, UVs) from 32-bit floats to fewer bits
- Entropy encoding - Compresses the quantized data using efficient encoding algorithms
- Decompression - The client (browser, engine) decompresses the mesh at load time
The result is significantly smaller files with a small, one-time decompression cost during loading.
Enable Draco export
To export GLB files with Draco compression, enable the module property before exporting:
ExportGLTFDraco# Enable Draco compression for GLB exportcore.setModuleProperty("IO", "ExportGLTFDraco", "True")# Export with Draco compression enabledio.exportScene("output/compressed_model.glb")
Draco compression settings
Draco compression can be fine-tuned using module properties. These settings control both the compression level and the quantization precision for different vertex attributes:
# Enable Draco compressioncore.setModuleProperty("IO", "ExportGLTFDraco", "True")# Set compression level (0-10, default: 7)core.setModuleProperty("IO", "GLTFDracoCompressionLevel", "7")# Configure quantization bits for vertex attributescore.setModuleProperty("IO", "GLTFDracoQuantizationPosition", "11") # Position (default: 11)core.setModuleProperty("IO", "GLTFDracoQuantizationNormal", "8") # Normals (default: 8)core.setModuleProperty("IO", "GLTFDracoQuantizationTexCoord", "10") # UVs (default: 10)core.setModuleProperty("IO", "GLTFDracoQuantizationVertexColor", "8") # Vertex colors (default: 8)
Compression level guidelines:
Level | Compression speed | File size | Use case |
|---|---|---|---|
| 0-3 | Fastest | Larger | Quick iterations, testing |
| 4-7 | Balanced | Good | Production use (recommended) |
| 8-10 | Slowest | Smallest | Final delivery, maximum compression |
Quantization guidelines
Quantization reduces attribute precision to save space. Choose appropriate bit depths based on your quality requirements:
Position quantization:
- 11 bits - Default, good balance for most models
- 14 bits - Higher precision for detailed models
- 8-10 bits - Maximum compression, acceptable for low-precision models
Normal quantization:
- 8 bits - Default, sufficient for smooth lighting in most cases
- 10 bits - Higher quality normals for detailed surfaces
- 6-7 bits - Maximum compression with potential lighting artifacts
UV quantization:
- 10 bits - Default, good balance for most textures
- 12 bits - Higher precision for detailed textures
- 8 bits - Maximum compression, acceptable for simple textures
Vertex color quantization:
- 8 bits - Default, standard color precision
4. Optimize textures for export
Textures can significantly increase file size. While Draco compresses mesh geometry, textures require separate optimization.
Reduce texture resolution
Lower resolution textures using material.resizeImage reduce file size dramatically:
# Resize all images to a maximum resolution# Get all images in the sceneimages = material.getAllImages()# Define maximum texture sizeMAX_SIZE = 2048# Resize each image if it exceeds the maximum sizefor image in images: width, height = material.getImageSize(image) width = size["width"] height = size["height"] # Check if resizing is needed if width > MAX_SIZE or height > MAX_SIZE: # Calculate new dimensions while maintaining aspect ratio if width > height: new_width = MAX_SIZE new_height = int((height / width) * MAX_SIZE) else: new_height = MAX_SIZE new_width = int((width / height) * MAX_SIZE) # Resize the image material.resizeImage(image, new_width, new_height)
Resolution | Use case | File size impact |
|---|---|---|
| 4096x4096 | Desktop, high-end applications | Very large |
| 2048x2048 | Desktop, VR, high-quality web | Large |
| 1024x1024 | Mobile, standard web | Medium |
| 512x512 | Low-end mobile, distant objects | Small |
Use KTX2 texture compression
KTX2 with Basis Universal compression is the recommended texture format for GLB exports. KTX2 provides GPU-compressed textures that dramatically reduce file size while maintaining good visual quality.
Why use KTX2 for GLB exports:
- Dramatically smaller files - 70-90% texture size reduction compared to PNG/JPEG
- GPU-ready format - Textures can be uploaded directly to GPU without decompression
- Universal compatibility - Transcodes to platform-specific formats (ETC, BC, ASTC) at runtime
- Complements Draco - Draco compresses geometry, KTX2 compresses textures
- glTF standard - Part of the official glTF 2.0 specification
Enable KTX2 texture export
Set the texture export format to KTX2 before exporting:
# Enable KTX2 texture format for GLB exportcore.setModuleProperty("Material", "ExportTextureFormat", "KTX2")# Configure KTX2 quality (1-255, default: 128)# Lower values = smaller files, lower quality# Higher values = larger files, better qualitycore.setModuleProperty("Material", "KtxQuality", "[128, 1, 255]")# Configure KTX2 compression level (1-5, default: 2)# 1 = Fastest compression, larger files# 5 = Slowest compression, smallest filescore.setModuleProperty("Material", "KtxCompression", "[2, 1, 5]")
KTX2 quality guidelines:
Quality | File size | Visual quality | Use case |
|---|---|---|---|
| 255 | Largest | Excellent | High-fidelity visualization |
| 128 | Medium | Good | Production use (recommended) |
| 64 | Small | Acceptable | Web, mobile with size priority |
| 32 | Smallest | Low | Maximum compression needed |
KTX2 compression level guidelines:
Level | Speed | File size | Use case |
|---|---|---|---|
| 5 | Slowest | Smallest | Final delivery, maximum reduction |
| 2-3 | Medium | Good | Production use (recommended) |
| 1 | Fastest | Larger | Quick iterations, testing |
Alternative texture formats
If not using KTX2, choose the appropriate format based on your export format:
PNG - Lossless compression, supports transparency
core.setModuleProperty("Material", "ExportTextureFormat", "PNG")core.setModuleProperty("Material", "PngCompression", "[6, 0, 9]") # 0-9, higher = smaller
JPEG - Lossy compression, no transparency, smaller than PNG
core.setModuleProperty("Material", "ExportTextureFormat", "JPEG")core.setModuleProperty("Material", "JpegQuality", "[85, 0, 100]") # 0-100, higher = better
Remove unused textures
Delete textures that aren't actually used in your scene:
# Merge duplicated imagesscene.mergeImages()# Remove unreferenced imagesscene.cleanUnusedImages()
5. Export workflow example
Here's a complete workflow that combines optimization and export with Draco compression:
# Export to GLB with Draco and KTX2 compression for lightweight files# Merge duplicated imagesscene.mergeImages()# Remove unreferenced imagesscene.cleanUnusedImages()# Resize all images to maximum 2048x2048MAX_SIZE = 2048images = material.getAllImages()for image in images: width, height = material.getImageSize(image) if width > MAX_SIZE or height > MAX_SIZE: if width > height: new_width = MAX_SIZE new_height = int((height / width) * MAX_SIZE) else: new_height = MAX_SIZE new_width = int((width / height) * MAX_SIZE) material.resizeImage(image, new_width, new_height)# Enable Draco compression for mesh geometrycore.setModuleProperty("IO", "ExportGLTFDraco", "True")# Enable KTX2 compression for texturescore.setModuleProperty("Material", "ExportTextureFormat", "KTX2")# Export to GLB format with Draco and KTX2 compression enabledio.exportScene("optimized_model.glb")
File size comparison
Here's what you can expect from following these guidelines:
Export configuration | Relative file size | Use case |
|---|---|---|
| FBX (unoptimized) | 100% | Baseline |
| GLB (unoptimized, no compression) | 80% | Better than FBX |
| GLB (optimized, no compression) | 40% | Mesh optimization only |
| GLB (unoptimized, Draco only) | 25% | Compression without opt |
| GLB (optimized, Draco only) | 10-15% | Good file size |
| GLB (optimized, Draco + KTX2) ← Recommended | 5-10% | Best file size |