18
Create a 3D game with WebGL and Babylon.js David Rousset - @davrous http://blogs.msdn.com/davrous Gaming Technical Evangelist

NGF2014 - Create a 3d game with webgl and babylon.js

  • Upload
    davrous

  • View
    944

  • Download
    1

Embed Size (px)

DESCRIPTION

We'll see in this session how to create 3D HTML5 WebGL games for the web (IE11/Chrome/Firefox & Opera) as well as for some mobile ecosystems. For that, we’ll show you our open-source Babylon.JS WebGL gaming engine available on GitHub: https://github.com/BabylonJS/Babylon.js You’ll see how to cover the complete gaming pipeline from the 3D assets created & exported from Blender/3DS Max/Maya to BabylonJS, the various camera's types (touch, device orientation, etc.), the usage of the embedded physic engine. At last, of course, how to implement the game logic in JavaScript. We'll build a simple game from scratch to better understand how to use this free engine.

Citation preview

Page 1: NGF2014 - Create a 3d game with webgl and babylon.js

Create a 3D game with WebGL and Babylon.js

David Rousset - @davroushttp://blogs.msdn.com/davrousGaming Technical Evangelist

Page 2: NGF2014 - Create a 3d game with webgl and babylon.js

Agenda Why building a WebGL 3D engine ?

The old school way: Using the 2D canvas Using WebGL directly

Using Babylon.js to create 3D apps and games Advanced features Handling touch devices Performance first Content Pipeline

Demos, demos & live code From Blender to the browser with no line of code Loading a scene by code Third-parties demos Live code session

Page 3: NGF2014 - Create a 3d game with webgl and babylon.js

Why building a WebGL 3D engine ?

Page 4: NGF2014 - Create a 3d game with webgl and babylon.js

The oldschool way: using 2D canvas

Build a 3D “Software” engine that only uses the CPU

Wireframe Rasterization Lights & Shadows Textures

Page 5: NGF2014 - Create a 3d game with webgl and babylon.js

Soft Engine

DEMONST

RATIO

N

Page 6: NGF2014 - Create a 3d game with webgl and babylon.js

Using WebGL directly

Requires a compatible browser:

A new context for the canvas:

canvas.getContext("webgl", { antialias: true}) || canvas.getContext("experimental-webgl", { antialias: true});

Page 7: NGF2014 - Create a 3d game with webgl and babylon.js

Using WebGL directly

WebGL is a low level API

Need to handle everythingexcept the rendering:

Shaders code (loading, compilation) Geometry creation, topology, transfer Shaders variables management Texture and resources management Render loop

Page 8: NGF2014 - Create a 3d game with webgl and babylon.js

Using Babylon.js to create 3D apps & games

Page 9: NGF2014 - Create a 3d game with webgl and 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 10: NGF2014 - Create a 3d game with webgl and babylon.js

Advanced features

Offline supportIndexedDB

Network optimizationsIncremental loading

Physics Engine

Complete collisions engine

Page 11: NGF2014 - Create a 3d game with webgl and babylon.js

Handling touch devices

Page 12: NGF2014 - Create a 3d game with webgl and babylon.js

Performance first

Efficient shadersDo only what is REALLY

requiredScene partitioningFrustum / submeshes /

octreesComplete cache system

Update WebGL only when required

Page 13: NGF2014 - Create a 3d game with webgl and babylon.js

Creation Pipeline

.babylon

Online converter

.FBX

.OBJ

.FBX

.OBJ

Page 14: NGF2014 - Create a 3d game with webgl and babylon.js

Enough of your blah-blah!Give us some demos, demos & live

code!

Page 15: NGF2014 - Create a 3d game with webgl and babylon.js

Unleash babylon.js

DEMONST

RATIO

N

Page 16: NGF2014 - Create a 3d game with webgl and babylon.js

Third-parties demos

DEMONST

RATIO

N

Page 17: NGF2014 - Create a 3d game with webgl and babylon.js

Live code with babylon.js

DEMONST

RATIO

N

Page 18: NGF2014 - Create a 3d game with webgl and babylon.js

Questions ?@deltakosh / @davrous