17
BABYLON.JS Unleash the power of 3D for the WEB

HTML5DevConf - Unleash the power of 3D with babylon.js

Embed Size (px)

DESCRIPTION

Talk I gave during HTML5DevConf 2014

Citation preview

Page 1: HTML5DevConf - Unleash the power of 3D with babylon.js

BABYLON.JSUnleash the power of 3D for the WEB

Page 2: HTML5DevConf - Unleash the power of 3D with babylon.js

[email protected] - @deltakosh - http://aka.ms/davca

DAVIDCATUHEPrincipal Program ManagerIE / Open Web StandardsDeveloper Experience and Evangelism

Page 3: HTML5DevConf - Unleash the power of 3D with babylon.js

An average of 1 version per month 32 contributors 34 releases 716 commits14400+ lines of code More than 125 files of code More than 330 forks A bandwidth of 1 TB per month for the website 1.3GB (Code and samples)

BABYLON.JS…

Page 4: HTML5DevConf - Unleash the power of 3D with babylon.js

HOW TO USE BABYLON.JS?Open source project (Available on Github)

http://www.babylonjs.comhttps://github.com/babylonjs/babylon.js

How to use it? Include one file and you’re ready to go!

To start Babylon.js, you’ve just need to create an engine object:

<script src="babylon.js"></script>

var engine = new BABYLON.Engine(canvas, true);

Page 5: HTML5DevConf - Unleash the power of 3D with babylon.js

HOW TO USE BABYLON.JS?Babylon.js is a scene graph: All complex features are abstracted for YOU!

Handling rendering can be done in one line:

var scene = new BABYLON.Scene(engine);

var camera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 0, -10), scene);var light0 = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(0, 100, 100), scene);var sphere = BABYLON.Mesh.createSphere("Sphere", 16, 3, scene);

engine.runRenderLoop(function() { scene.render(); });

Page 6: HTML5DevConf - Unleash the power of 3D with babylon.js

DID YOU SAY FEATURES?Complete scene graph with lights, cameras, materials and meshesCollisions enginePhysics engine (thanks to cannon.js)Scene pickingAntialiasingAnimations engineParticles SystemsSprites and 2D layersFrustum clippingSub-meshes clippingHardware scalingSelection octreesOffline mode (Assets are saved locally to prevent reloading them)Incremental loadingBinary formatHardware accelerated instancesDiffuse lightning and textureAmbient lightning and textureSpecular lightningOpacity textureReflection texture (Spheric, planar, cubic and

projection)Mirror textureEmissive textureSpecular textureBump textureUp to 4 lights (points, directionals, spots, hemispherics)Custom materialsSkyboxVertex color4 bones per vertexFresnel termFogAlpha blendingAlpha testingBillboardingFullscreen modeShadow Maps and Variance Shadow MapsRendering layersPost-processes (blur, refraction, black'n'white, fxaa, customs...)Lens flaresMulti-views

Render target texturesDynamic textures (canvas)Video texturesCompressed (DDS) texturesArc rotate cameraFree cameraTouch cameraVirtual Joysticks cameraOculus Rift cameraGamepad cameraMesh cloningDynamic meshesHeight mapsBonesConstructive solid geometriesBabylon scene file can be converted from .OBJ, .FBX, .MXBExporter for BlenderExporter for Cheetah3dExporter for 3ds MaxSupport for drag'n'drop….

Page 7: HTML5DevConf - Unleash the power of 3D with babylon.js

FIRST CONTACTHello world Babylon.js

Page 8: HTML5DevConf - Unleash the power of 3D with babylon.js

LEARN & EXPERIMENT

Playground CYOS

Page 9: HTML5DevConf - Unleash the power of 3D with babylon.js

WORKING WITH ASSETS

Blender 3D 3DS Max .OBJ, .FBX, .DAE

.BABYLON

Exporters / Online converter

Page 10: HTML5DevConf - Unleash the power of 3D with babylon.js

.BABYLON FORMATS.

BABYLON

One scene fileJSON format

.INCREMENTAL.BABYLON

One scene fileOne data file per meshJSON format for both

.BINARY.BABYLON

One scene fileOne data file per mesh.JSON format for sceneBINARY data for meshData loaded directly to GPU

Espilit demo: 22MB / 4MB (gzip)

Espilit demo: 22MB / 4MB (gzip)

Espilit demo: 9MB / 3MB (gzip)

Page 11: HTML5DevConf - Unleash the power of 3D with babylon.js

Touch

Camera based on pointer events

Device Orientatio

nCamera

based on Device

Orientation API

Virtual JoysticksUsing pointer events, this

camera generates

two joysticks on

top of the scene

Anaglyph

Use this camera with Red/Green

glasses

VR

Control camera

orientation with:

Oculus RiftWebVR

CardBoard

Gamepad

Use your gamepad to control your

camera

PLAYING WITH INPUT

Page 12: HTML5DevConf - Unleash the power of 3D with babylon.js

COLLISIONS & PHYSICS

Page 13: HTML5DevConf - Unleash the power of 3D with babylon.js

UNIVERSAL APPCreating Windows and Windows Phone apps with Babylon.js

Page 14: HTML5DevConf - Unleash the power of 3D with babylon.js

USEFUL LINKS

http://www.babylonjs.com

http://www.babylonjs.com/playground

http://www.babylonjs.com/cyos

https://github.com/BabylonJS/Babylon.js/wiki

http://www.html5gamedevs.com/forum/16-babylonjs

Page 15: HTML5DevConf - Unleash the power of 3D with babylon.js

01 | 3D on the Web: Understanding the Basics 02 | WebGL Basics

03 | Using Babylon.js for Beginners 04 | Understanding materials and inputs

05 | Game Pipeline Integration with Babylon.js 06 | Loading Assets

07 | Babylon.js: Advanced Features 08 | Special Effects

Page 16: HTML5DevConf - Unleash the power of 3D with babylon.js

Take a survey and win an IE tee-shirt

WANNA DISCUSS ?Most of the time on Microsoft Booth (25)

Page 17: HTML5DevConf - Unleash the power of 3D with babylon.js

THANK

YOU!