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

Importing and managing animated models


To finish this chapter with a cool demo, let's discuss how to animate characters or 3D models, in general.

How 3D animated models work

If you remember, each vertex of a 3D model is computed to be projected on the screen by a vertex shader. In fact, the animated 3D models (such as a character) are also animated with the associated hierarchy of bones (the hierarchy is called Skeleton). Animated 3D models are also called Skinned Meshes. In 3D engines, the bones are invisible nodes that are animated (BABYLON.Animation) to be sent to the vertex shader associated with the 3D model. In other words, the transformation of each bone is sent to the vertex shader and is applied to the associated vertices.

To go further in the theory, the vertex shader contains the following two additional buffers:

  • The bones' matrices weights (Vector4, represents the intensity of the influence of each bone on the current vertex).
  • The bones' matrices indices (Vector4, until four bone...