Convert Figma logo to code with AI

KhronosGroup logoglTF-Blender-IO

Blender glTF 2.0 importer and exporter

1,475
316
1,475
196

Top Related Projects

10,727

The official Open-Asset-Importer-Library Repository. Loads 40+ 3D-file-formats into one unified and clean data structure.

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.

12,695

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

101,622

JavaScript 3D Library.

Quick Overview

The glTF-Blender-IO repository is an official Blender add-on for importing and exporting glTF 2.0 files. It allows users to seamlessly work with glTF assets in Blender, supporting both glTF and GLB formats. This project is maintained by the Khronos Group and is an essential tool for 3D artists and developers working with glTF files in Blender.

Pros

  • Officially supported by Blender and the Khronos Group
  • Supports both import and export of glTF 2.0 files
  • Handles complex features like animations, materials, and textures
  • Regular updates and active community support

Cons

  • May have limitations with certain advanced glTF features
  • Performance can be slow with very large or complex models
  • Occasional compatibility issues with specific Blender versions
  • Learning curve for users new to glTF or Blender add-ons

Getting Started

  1. Download the latest release from the GitHub repository.
  2. In Blender, go to Edit > Preferences > Add-ons.
  3. Click "Install" and select the downloaded ZIP file.
  4. Enable the "Import-Export: glTF 2.0 format" add-on.
  5. Use File > Import > glTF 2.0 to import glTF files.
  6. Use File > Export > glTF 2.0 to export glTF files.

Note: This add-on is included by default in recent Blender versions, so you may only need to enable it in the Add-ons preferences.

Competitor Comparisons

10,727

The official Open-Asset-Importer-Library Repository. Loads 40+ 3D-file-formats into one unified and clean data structure.

Pros of assimp

  • Supports a wide range of 3D file formats (40+), not limited to glTF
  • Can be used in various programming languages and environments beyond Blender
  • Provides a unified API for importing and exporting different 3D formats

Cons of assimp

  • Less specialized for glTF format compared to glTF-Blender-IO
  • May have larger overhead due to supporting multiple formats
  • Potentially slower performance for glTF-specific operations

Code Comparison

glTF-Blender-IO (Python):

import bpy
from io_scene_gltf2.io.imp import gltf2_io_gltf

gltf = gltf2_io_gltf.glTFImporter(filepath)
gltf.read()

assimp (C++):

#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(filepath, aiProcess_Triangulate | aiProcess_FlipUVs);

Both libraries provide functionality for importing 3D models, but assimp offers a more generalized approach supporting multiple formats, while glTF-Blender-IO is tailored specifically for glTF integration with Blender.

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.

Pros of Babylon.js

  • Full-featured 3D engine with extensive capabilities beyond glTF handling
  • Active community and regular updates
  • Comprehensive documentation and examples

Cons of Babylon.js

  • Larger codebase and potentially steeper learning curve
  • May include unnecessary features for projects focused solely on glTF

Code Comparison

glTF-Blender-IO (Python):

def export_gltf(context, export_settings):
    gltf = {}
    gltf['asset'] = {'version': '2.0'}
    # ... (additional export logic)

Babylon.js (TypeScript):

export class GLTF2Export {
    public static GLTFAsync(scene: Scene, name: string): Promise<GLTFData> {
        const exporter = new _Exporter(scene);
        return exporter._generateGLTFAsync(name);
    }
}

glTF-Blender-IO focuses specifically on Blender integration for glTF import/export, while Babylon.js offers a complete 3D engine with glTF support as one of its many features. glTF-Blender-IO is more lightweight and specialized, while Babylon.js provides a broader range of functionality for web-based 3D applications.

12,695

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

Pros of Cesium

  • Comprehensive 3D geospatial visualization library
  • Supports a wide range of data formats and sources
  • Active community and regular updates

Cons of Cesium

  • Steeper learning curve due to its extensive features
  • Larger file size and potentially higher resource usage
  • May be overkill for simple 3D rendering tasks

Code Comparison

glTF-Blender-IO (Python):

class ExportGLTF2_Base:
    def __init__(self, context, export_settings):
        self.context = context
        self.export_settings = export_settings

Cesium (JavaScript):

var viewer = new Cesium.Viewer('cesiumContainer', {
    terrainProvider: Cesium.createWorldTerrain()
});
viewer.scene.globe.enableLighting = true;

glTF-Blender-IO focuses on Blender integration and glTF export/import, while Cesium provides a complete geospatial visualization platform. glTF-Blender-IO is more specialized for 3D modeling workflows, whereas Cesium offers broader capabilities for mapping and geospatial applications. The code examples highlight the different approaches: glTF-Blender-IO uses Python for Blender integration, while Cesium uses JavaScript for web-based 3D visualization.

101,622

JavaScript 3D Library.

Pros of three.js

  • Comprehensive 3D graphics library for web applications
  • Large community and extensive documentation
  • Supports various 3D formats and rendering techniques

Cons of three.js

  • Steeper learning curve for beginners
  • Larger file size, which may impact load times
  • Not specifically designed for glTF integration

Code Comparison

three.js:

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

glTF-Blender-IO:

import bpy
bpy.ops.export_scene.gltf(
    filepath="model.gltf",
    export_format='GLTF_SEPARATE',
    use_selection=True
)

The code snippets demonstrate the different focus of each project. three.js is used for creating and rendering 3D scenes in web browsers, while glTF-Blender-IO is primarily used for exporting glTF files from Blender.

glTF-Blender-IO is specifically designed for Blender integration and glTF export/import, making it more suitable for 3D artists and developers working with Blender. three.js, on the other hand, offers a more versatile solution for web-based 3D graphics but requires more setup and configuration for glTF support.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Blender glTF

Blender glTF 2.0 Importer and Exporter

Documentation

Blender VersionDocumentation
4.2https://docs.blender.org/manual/en/4.2/addons/import_export/scene_gltf2.html
devhttps://docs.blender.org/manual/en/dev/addons/import_export/scene_gltf2.html

Notes:

  • 4.2 is the current stable release. Check the blender-v4.2-release branch (and 4.2.x tag)
  • 2.80 - 4.1 are previous stable releases.
  • 4.2.x is the current Blender LTS release. Check the blender-v4.2-release branch (and 4.2.x tag)
  • main branch of this addon is mirrored in Blender Addons main, that will become Blender 4.3.

Legacy 2.79 Support

The final version of this addon with legacy support for Blender 2.79 is available on the 2.79 Release Page.

Blender 2.80 and higher bundle this addon in the main Blender install package, so no 3rd-party install is required.

Credits

Developed by UX3D, Scurest and Julien Duroure, with support from the Khronos Group, Mozilla, and Airbus Defense & Space.

Introduction

Official Khronos Group Blender glTF 2.0 importer and exporter.

This project contains all features from the previous exporter, and all future development will happen on this repository. In addition, this repository contains a Blender importer, with common Python code shared between exporter and importer for round-trip workflows. New features are included or under development, but usage and menu functionality remain the same.

The shared codebase is organized into common (Blender-independent) and Blender-specific packages:

Packages Package organisation

This structure allows common code to be reused by third-party Python packages working with the glTF 2.0 format.

Process Import & export process

The main importer and exporter interface is the Python glTF scene representation. Blender scene data is first extracted and converted into this scene description. This glTF scene description is exported to the final JSON glTF file. Any compression of mesh, animation, or texture data happens here. For import, glTF data is parsed and written into the Python glTF scene description. Any decompression is executed in this step. Using the imported glTF scene tree, the Blender internal scene representation is generated from this information.

Installation

The Khronos glTF 2.0 importer and exporter is enabled by default in Blender 2.8 and higher. To reinstall it — for example, when testing recent or upcoming changes — copy the addons/io_scene_gltf2 folder into the scripts/addons_core/ directory of the Blender installation, then enable it under the Add-ons tab. For additional development documentation, see Debugging.

Debugging

Continuous Integration Tests

Several companies, individuals, and glTF community members contribute to Blender glTF I/O. Functionality is added and bugs are fixed regularly. Because hobbyists and professionals using Blender glTF I/O rely on its stability for their daily work, continuous integration tests are enabled. After each commit or pull request, the following tests are run:

  • Export Blender scene and validate using the glTF validator
  • Round trip import-export and comparison of glTF validator results

These quality-assurance checks improve the reliability of Blender glTF I/O.

CI

Running the Tests Locally

To run the tests locally, your system should have a blender executable in the path that launches the desired version of Blender.

The latest version of Yarn should also be installed.

Then, in the tests folder of this repository, run yarn install, followed by yarn run test.

Main branch

The main branch was renamed on 2023 January, 12th. If you need to update your local repository, you can use the following documentation

Some Technical documentation

Want to fix some bugs or add some enhancement? You will find some technical overview of this addon here