Category Archives: Babylon.js

Auto Added by WPeMatico

Announcing Babylon.js v3.2

Babylon.js is an open source framework designed from ground up to help create easy and powerful 3D experiences in your browser or your web apps.
Today I’m excited to announce the availability of Babylon v3.2.

As usual, our wonderful community helped build a massive list of features and fixes for this release. I highly encourage you to read through it as it is full of cool demos that highlight new capabilities available for you right out of the box.
I would also like to take some time here to detail some of the new features that best characterize this release:
Rendering improvements
One of the goals of v3.2 was to make sure that the engine runs very well on all kinds of browsers and devices. When running 3D experiences on browsers, you must make sure that time spent executing JavaScript is reduced to a bare minimum to really leverage the raw power of GPUs. Therefore, we introduced multiple new cache layers all over the engine to keep track of the states of all objects. We also moved to a push approach where the engine is told by entities that something changed, and the cache must be updated.
The engine was previously in a pull mode where it would ask the state of the entities when needed.
These changes can improve rendering speed on large scenes by a significant amount.
While optimizing the engine itself, we also wanted to leverage more WebGL 2.0 features. You can find on this page the list of WebGL 2.0 features we are currently supporting (including a description of the potential fallbacks when WebGL 2.0 is not supported by your browser). One feature I’d like to mention is support for improved shadows with techniques like PCF (Percentage Closer Filtering) and contact hardening shadows. These two features provide even more realistic real time shadows like in this demo (you can notice that shadows are more dense when close to the emitters):

(Please note that this demo will fall back to another rendering technique if your browser does not support WebGL2)
Alongside with shadows, this version also improves the anti-aliasing algorithm with a new option named specular anti-aliasing. This will help reducing visual artifacts on shiny objects. You can play with this new option in this interactive demo:

Embracing modern JavaScript
Babylon.js is developed using TypeScript. This gives us a powerful tool to embrace new JavaScript features as we can decide which flavor of JavaScript we can generate from TypeScript.
With v3.2 we decided to support Promises (and for the sake of cross compatibility we also added a custom polyfill). We also introduced async functions which returns Promises like this one: http://doc.babylonjs.com/api/interfaces/babylon.isceneloaderpluginasync#loadassetcontainerasync
When a function returns a promise, modern browsers let us use the new await keyword. This new keyword (which will be familiar for C# developer) let you create asynchronous code like it would be synchronous:

// load the assets
var rootURL = ‘https://models.babylonjs.com’;
var filename = ‘ufo.glb’;
var container = await BABYLON.SceneLoader.LoadAssetContainerAsync(rootURl, filename, scene);
container.addAllToScene();

scene.createDefaultEnvrionment();

You can see a live example here.
Animation support improvements
Babylon.js already had rich support for multiple types of animation, and with 3.2 we wanted to provide more tools, so developers could build even better animated content.  To do this, we added support for animation blending and animation weights.
Animation blending is an automatic system that allows developers to seamlessly transition from one animation to another. In the following demo, you can select individual animations with provided buttons and you will see that Babylon.js will automatically blend them to provide a natural transition:

Animation weights is a technique that allows developers to mix multiple animations by specifying weights for each of them. On the following demo, you can play with the sliders to change the weights or directly start an animation:

More special effects
We completely rewrote the default rendering pipeline for Babylon.js v3.2. The goal was to provide a one stop shop for a large list of special effects that developers could easily add to their scenes. In the following demo, you can play with:
Multisample anti-aliasing (MSAA)
Fast approximate anti-aliasing (FXAA)
Tone mapping
Contrast
Exposure
Color curves
Bloom
Depth of field
Chromatic aberration
Sharpen
Vignette effect
Grain

We also added support for a long-requested feature: The glow layer. This effect will make emissive part of your object appear glowing (really useful to simulate source of lights) as you can see on the following demo:

As part of our commitment to WebGL 2.0 we also added support for GPU particles. Previously, particles were animated by the CPU and rendered by the GPU. Now with GPU particles, we can animate and render them using only the GPU which lets us handle far more particles with much better performance. Feel free to play with them with this interactive demo:

GPU particles are entirely compatible with CPU particles, so you can always fallback to CPU particles if WebGL 2.0 is not supported.
Documentation
After 6 years, we all considered it would be the right time to improve our API documentation. We happily switched all of it to TypeDoc which produces neat documentation pages:

I would also like to give a special shout out to the whole Babylon.js community which was helpful to write and complete our documentation and code comments.
We also added a new section named “Examples” where you can browse live examples for specific Babylon.js features. Every example comes with a link to the associated documentation to understand how to use the demonstrated feature:

This list will quickly grow with more examples.
glTF
We want Babylon.js to be the best engine to load, edit and view glTF models.  With this release, we continued our investment in the format with several new features and improvements including:
Refactored the loader to make it more flexible
Draco compression extension support
Unlit materials extension support (not yet ratified)
Lights extension support (not yet ratified)
Primitive mode support
Performance improvements
Alongside Babylon.js v3.2, we are also shipping new features for our exporters:
We added support for glTF files in our Autodesk 3dsMax exporter
We added a new Autodesk Maya exporter which can produce glTF files
We also released a new API within Babylon.js to generate glTF files from any Babylon.js scene. For instance, you can see in this demo that you can build a new object by doing boolean operations. And then thanks to our glTF exporter, you are one line of code away from getting a glTF file of your creation.

var gltf = BABYLON.GLTF2Export.GLB(scene, "bowl.glb");
gltf.downloadFiles();

Furthermore, the Sandbox (the tool where you can drag and drop your meshes to visualize them) was improved to let you test glTF / glb animations as well:

There still are more features to discover in this release, so if you want to know more or just want to experiment with our latest demos, please visit http://www.babylonjs.com/.
And if you want to join the community and contribute, please join us on GitHub!

Announcing Babylon.js v3.1

Babylon.js is an open source framework that allows you to easily create stunning 3D experiences in your browser or your web apps.
Built with simplicity and performance in mind, it is the engine that fuels the Remix3D site, Xbox Design Lab or 3D objects preview in Teams or OneDrive on the web.
Earlier this year we announced the third version of the engine. Today I’m glad to announce its first update: Babylon.js v3.1.

The main goal of this version was to provide helpers to achieve high end tasks. Let’s see some of them:

Improving VR experiences with the VRExperienceHelper
Babylon.js v3.0 introduced support for WebVR and VR controllers (including Windows Mixed Reality, Oculus and HTC Vive). With 3.1 release, we wanted to make the process to add VR experience in your code simple.
Therefore, we introduced the VRExperienceHelper which will take care of the following for you:
Create the HTML button to enter VR mode
Create a WebVRCamera (if supported) and a DeviceOrientationCamera as a fallback (this camera will allow you to use device orientation events to control your scene. This is useful on mobiles for instance)
Add support for teleportation and rotation in the same way you can experience it in the Windows Mixed Reality cliff house
Add support for controllers picking (you can use your controllers to interact with the scene) and gaze picking (you can use your gaze to interact)
All of this will be available with literally 3 lines of code:

var VRHelper = scene.createDefaultVRExperience();
VRHelper.enableTeleportation({floorMeshName: "Sponza Floor"});

You can try it here: https://www.babylonjs-playground.com/frame.html#JA1ND3#15

We also added more WebVR demos on our homepage for you to try:

Building a 3D experience with 2 lines of HTML with Babylon.js Viewer
Babylon.js viewer is a new tool to allow you to integrate 3D into your web sites or web apps in a couple of seconds. Everything can be done directly from your web page:

<body>
<babylon model.title="Damaged Helmet"
model.subtitle="BabylonJS"
model.thumbnail="https://www.babylonjs.com/img/favicon/apple-icon-144×144.png"
model.url="https://www.babylonjs.com/Assets/DamagedHelmet/glTF/DamagedHelmet.gltf">
</babylon>
<script src="//viewer.babylonjs.com/viewer.js "></script>
</body>

With these two lines of HTML you can create a complete touch aware 3D viewer anywhere in your page.
http://viewer.babylonjs.com/basicexample
The viewer can be configured in all possible way either with HTML attributes, JavaScript code or even with DOM elements:

<babylon extends="minimal" scene.default-camera="false">
<model url="https://playground.babylonjs.com/scenes/BoomBox.glb" title="GLB Model" subtitle="BabylonJS">
</model>
<camera>
<behaviors>
<auto-rotate type="0"></auto-rotate>
</behaviors>
</camera>
<lights>
<light1 type="1" shadow-enabled="true" position.y="0.5" direction.y="-1" intensity="4.5">
<shadow-config use-blur-exponential-shadow-map="true" use-kernel-blur="true" blur-kernel="64" blur-scale="4">
</shadow-config>
</light1>
</lights>
</babylon>

All the user interface can be updated to reflect your brand and the configuration model can also be extended.
Please follow this link to our documentation to learn mode about the Babylon.js viewer: http://doc.babylonjs.com/extensions/the_babylon_viewer
Create your demo setup with a few lines of code thanks to the EnvironmentHelper
For non-3D experts, setting up a 3D environment (lights, skyboxes, etc.) could be tricky. Therefore, we added a tool named EnvironmentHelper and directly available on the scene to help you with this task.
Using it is straightforward:

var helper = scene.createDefaultEnvironment();
helper.setMainColor(BABYLON.Color3.Teal());

And you can then get a good-looking setup (skybox + ground) adapted to your scene:

The helper offers a lot of options like enabling reflections or shadows:

var helper = scene.createDefaultEnvironment({
enableGroundMirror: true,
groundShadowLevel: 0.6,
});

See a live version here: https://www.babylonjs-playground.com/#4AM01A
Helping the community with our glTF exporter for Autodesk 3dsmax
We introduced support for glTF 2.0 in Babylon.js 3.0 and we wanted to help our community to produce assets in this open standard format. This is the reason why we worked on adding support for glTF export in our Autodesk 3dsmax exporter.
You can now create your scene in 3dsmax and directly export it to glTF in one click:

More info here: http://doc.babylonjs.com/resources/3dsmax_to_gltf
From the client to the server: Introducing the NullEngine
Starting with Babylon.js v3.1, we introduced the NullEngine which is a version of the main Babylon.js engine but we no need for a WebGL capable device.
The NullEngine will obviously not produce any rendering and thus can be used in a node.js / server-side environment.
It can be used to:
Run tests
Run a server-side version of your application / game
Use specific Babylon.js services (like glTF loaders for instance)
More details can be found here: http://doc.babylonjs.com/features/nullengine
Improving the codebase
Babylon.js is entirely written in TypeScript. In order to improve the quality of the code we decided to turn on all strict type checking offered by the latest version of TypeScript (like the strict null check introduced by TypeScript 2.0 or the strict function types added by TypeScript 2.6).
With stricter type checking we can capture errors and bugs at compilation time and thus provide more reliable code for the community.
Improving documentation
Writing good documentation is a complex task. With this release we added more content for beginners. We now have complete course starting from scratch and going through all important aspects of the engine.

We also added several multi-steps guide so you can read and learn at your own pace.
If you want to know more or just want to experiment with our latest demo, please visit http://www.babylonjs.com/.
And if you want to join the community and contribute, please join us on GitHub!