Compressed Interactive Unity GLTF Content

Compressed Interactive Unity GLTF Demo

This is a playground demonstrating the Babylon Toolkit support for generating compressed
Interactive Unity GLTF Scene Files

What makes the exported content interactive are the script components and game object setup like zero code physics configuration. You get all this by simply loading the Interactive Unity GLTF Scene File using any one the BabylonJS Scene Loaders or Asset Manager (And the babylon.toolkit.js runtime library is loaded of course).

What makes the exported content compressed is the webp compressed textures except for specialty maps like lightmaps, heightmaps and splatmaps which must remain lossless png to maintain pixel precision and hdr lighting.

The entire scene payload (json and bin) was compressed using the built in toolkit support for generating gzipped compressed scene files (.gz.gltf and .gz.glb and .gz.bin)

Loading compressed scene files:

// This loads the sample scene & player armature exported from a unity starter assets project
// https://assetstore.unity.com/packages/essentials/starter-assets-character-controllers-urp-267961
const assetsManager:BABYLON.AssetsManager = new BABYLON.AssetsManager(scene);
assetsManager.addMeshTask("samplescene", null, UNITY.SceneManager.PlaygroundRepo, "samplescene.gz.gltf");
assetsManager.addMeshTask("playerarmature", null, UNITY.SceneManager.PlaygroundRepo, "playerarmature.gz.gltf");

These two Interactive Unity GLTF Scene Files provide the core functionality of the Unity Third Person Player Controller Starter Asset exported by the toolkit to the native BabylonJS environment

Compressed Interactive Unity GLTF Demo

5 Likes

This is Amazing. It’s a little bit over my head but this is like that!!! I like how the unity physics are imported to Babylon.JS. Does this mean any kind of unity programmed physics can be ported to babylon? such as unity asset physics?

Pretty much… All Unity collider types and the rigid body components are supported for export. At runtime any programmed physics interactions can be ported as well. Pretty much all physics engines have some sort of API you use to interact with bodies… like AddForce, AddImpulse or directly setting the linear and angular velocities… updating properties like mass, inertia etc…