Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
blender
demo release and fix android versions Apr 6, 2019
docs html release Dec 22, 2018
gltf
gradle/wrapper init from POC Dec 19, 2018
.gitignore added metallic roughness test Dec 22, 2018
LICENSE init from POC Dec 19, 2018
README.md
TODO.md update doc Jan 20, 2019
build.gradle init from POC Dec 19, 2018
gradle.properties init from POC Dec 19, 2018
gradlew init from POC Dec 19, 2018
gradlew.bat init from POC Dec 19, 2018
settings.gradle init from POC Dec 19, 2018

README.md

LibGDX GLTF 2.0 and PBR shader implementation Work In Progress

status

Release

LibGDX - GL Transmission Format (glTF) 2.0 Support

Implementation based on official glTF 2.0 Specification

Shaders inspiried by glTF-WebGL-PBR demo :

Demo

  • HTML : the online demo is available here and only contains few examples.
  • Desktop : the desktop demo is available here. It remotly loads a lot of example. see gdx-gltf-demo readme for futher information.
  • Android : the Android demo is available on Play Store and only contains few examples (same as HTML version).

GLTF extensions implemented

Getting started

Install

gdx-gltf is avilable via Jitpack.

ensure you have jitpack repository declared in your Gradle configuration :

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add dependency in your core project :

project(":core") {
    dependencies {
    	...
        compile "com.github.mgsx-dev.gdx-gltf:gltf:master-SNAPSHOT"
    }
}

Loading asset files

Directly

SceneAsset sceneAsset = new GLTFLoader().load(Gdx.files.internal("myModel.gltf"));
SceneAsset sceneAsset = new GLBLoader().load(Gdx.files.internal("myModel.glb"));

Using AssetManager loaders

assetManager.setLoader(SceneAsset.class, ".gltf", new GLTFAssetLoader());
assetManager.setLoader(SceneAsset.class, ".glb", new GLBAssetLoader());
...
assetManager.load("myModel.gltf");
...
SceneAsset sceneAsset = assetManager.get("myModel.gltf", SceneAsset.class);

Render models

This library provides a convenient scene manager to handle glTF models and PBR shader.

see Example code for more information.

Export models from Blender

More about the library

Project structure

This repository is made of a library and a demo :

  • gltf project aims to be a LibGDX extension in the future. see gdx-gltf readme for futher information.
  • demo folder contains a LibGDX demo project with usual modules (core, desktop, android, html, ...) see gdx-gltf-demo readme for futher information.

LibGDX integration notes

Morph targets

Several classes has been hacked in order to support morph targets :

  • ModelInstance
  • Node
  • NodePart
  • NodeAnimation
  • AnimationController

LibGDX could be modified to remove all this hacks by either :

  • adding morph target full support
  • allowing proper overrides

Loading process

One of GLTF design goal is "Fast loading" : glTF data structures have been designed to mirror the GPU API data as closely as possible.

Due to LibGDX platform abstraction, this implementation require to process data (mainly vertices), so loading performances are not optimal for now but could be improved by directly loading mesh data.

Mesh limitations

LibGDX only support signed short indices, mesh are then limited to 32768 vertices.

WebGL limitations

LibGDX Pixmap loading from binary data is not supported by its GWT emulation. So, GLTF embeded and binary formats are not supported for html/WebGL target.

You can’t perform that action at this time.