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

Using post-processes with Babylon.js


Fortunately, you'll not have to create post-processes yourself, even if you can do it with Babylon.js. There are post-processes already available in Babylon.js and in most cases, available by writing only a line of code!

Starting with your first post-process

With the post-processes available in Babylon.js, you can create blur, bloom, HDR, SSAO, volumetric light post-processes, and so on.

Let's start with the following scene:

For the first example, let's create a vertical blur post-process using the built-in post-processes. The blur post-process is available by creating a new instance of the BABYLON.BlurPostProcess class, as follows:

var blurV = new BABYLON.BlurPostProcess(
  "blurV", // Name of the post-process
  new BABYLON.Vector2(0, 1), // Direction of the blur (vertical)
  4, // The blur width
  0.5, // The ratio of the post-process
  camera // The camera to attach to
);

The result is as shown in the following screenshot:

...