Book Image

Babylon.js Essentials

By : Julien Moreau-Mathis
Book Image

Babylon.js Essentials

By: Julien Moreau-Mathis

Overview of this book

Are you familiar with HTML5? Do you want to build exciting games and Web applications? Then explore the exciting world of game and Web development with one of the best frameworks out there: Babylon.JS. Starting from the beginning, the book introduces the required basics for 3D development and the knowledge you need to use the Babylon.js framework. It focuses on the simplicity provided by Babylon.js and uses a combination of theory and practice. All the chapters are provided with example files ready to run; each example file provides the previously learned features of the framework. Finally, developers will be ready to easily understand new features added to the framework in the future.
Table of Contents (15 chapters)
Babylon.js Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Preface

3D development has always been something mystic. Starting from the beginning, this book introduces the required basics of 3D development and the knowledge you require to use the Babylon.js framework. It focuses on the simplicity provided by Babylon.js and uses a combination of theory and practice. All the chapters are provided with example files that are ready to run; each example file provides the previously learned features of the framework. Finally, the developers will be ready to easily understand the new features that are added to the framework in the future and use the more advanced features only using the documentation.

What this book covers

Chapter 1, Babylon.js and the TypeScript Language, provides a quick introduction to the Babylon.js story and a course on a fundamental that is the TypeScript language.

Chapter 2, The Fundamentals of Babylon.js and Available Tools, starts with the Babylon.js framework and creates the first 3D scene, showing the simplicity of the framework along with the theory.

Chapter 3, Create, Load, and Draw 3D Objects on the Screen, starts with the concepts of Chapter 2, The Fundamentals of Babylon.js and Available Tools, let's introduce the right way to create 3D scenes and work with 3D artists.

Chapter 4, Using Materials to Customize 3D Objects Appearance, explains the notion of materials in 3D engines. In other words, let's unleash the Babylon.js Standard Material.

Chapter 5, Create Collisions on Objects, focuses on the gameplay itself by managing the collisions in your scenes, including physics simulation.

Chapter 6, Manage Audio in Babylon.js, explains one of the added values of the Babylon.js framework. Let's add and manage sounds, including spatialized sounds, in your scenes.

Chapter 7, Defining Actions on Objects, introduces a smart way to trigger actions on the 3D objects themselves without to many lines of code as some tasks can be a pain for developers.

Chapter 8, Add Rendering Effects Using Built-in Post-processes, shows the preferred part of most of the 3D developers. This shows and explains how to easily beautify the 3D scenes using post-processes effects, combined with the simplicity provided by Babylon.js.

Chapter 9, Create and Play Animations, allows us to play with the animations system provided by Babylon.js. This chapter provides the final skill that you need in order to be ready to build your own professional 3D application!

What you need for this book

This book targets HTML5 developers, who want to build complete 3D video games or applications on browsers. The reader should have some familiarity with the JavaScript language and basic 3D representations (notion of vectors and dimensions). The Babylon.js framework is designed to be easy to use, therefore, no 3D development background is needed and beginners are welcome.

Who this book is for

Babylon.js Essentials is intended for developers, who want to enter the world of 3D development for the Web or add the Babylon.js framework to their skill set. The notion of object-oriented programming would be helpful to understand the architecture of the Babylon.js framework. Also, familiarity with Web development would be useful to understand the principles used.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "With TS, typing new Array() is equivalent to new Array<any>()."

A block of code is set as follows:

var skybox = BABYLON.Mesh.CreateBox("skybox", 300, scene); 
var skyboxMaterial = new BABYLON.StandardMaterial("skyboxMaterial", scene); 
skyboxMaterial.backFaceCulling = false; 
skyboxMaterial.reflectionTexture = 
  new BABYLON.CubeTexture("skybox/TropicalSunnyDay", scene);

Any command-line input or output is written as follows:

var myVar: FileAccess = FileAccess.Read; // Equivalent to 0

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Select the file location as you did for Blender to save the Babylon.js scene and click on Export."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at http://www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/BabylonJSEssentials_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at  with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.