WebGL: Up and Running

Author: Tony Parisi
Publisher: O'Reilly
Pages: 230
ISBN: 978-1449323578
Audience: JavaScript programmers
Rating: 4.5
Reviewer: Mike James

 

Can you learn WebGL without getting involved in the very basic nuts and bolts like shaders and so on?

 

The big problem with WebGL is that it is very low level. If you are expecting to get involved with cameras and lights then think again. WebGL expects you to set up shaders, which are fairly complex programs in a C-like dialect to control how surfaces are rendered. This makes getting started with WebGL a slow and technical process.

Many programmers don't want or need to get into the powerful but difficult area of custom shaders - they just want to define and render 3D objects and create scenes that can be animated and used in games, simulations and so on. The problem is how to get them into WebGL?

This book takes the approach of augmenting WebGL with a 3D graphics engine - Three.js. What this means is that you work with 3D graphics in terms of meshes, cameras and lighting and so avoid the whole issue of shaders, which are provided for you by the engine. The only problem with this approach is if you actually want to master the low-level details of WebGL. Even if you do, starting off with a 3D graphics engine and finding out about shaders later on is still a good way into a complex subject.

However, it is important to realize that if you want an approach to WebGL that isn't based on Three.js you need a different book.

Banner

This said, the book does start off with an overview of WebGL and a simple program to draw a square. This is almost used as a motivation for adopting a 3D engine, as the next chapter introduces Three.js with a program that does the same thing in 30 lines as opposed to the original 150.

Next we move on to rendering a textured cube, something that usually takes a lot longer to reach taking the unaided route.

Chapter 3 uses a simple simulation example to introduce wider ideas on how to create meshes and textures. It also deals with particle systems and introduces custom shaders, but mostly concentrating on Three.js. From here we move on to animation in Chapter 4, again covering some basic principles, but quickly moving to Tween.js - a library that makes it all easy.

Next, Chapter 5 deals with hit detection and user interaction using Three.js. Chapter 6 is on integrating 2D and 3D graphics. Chapters 7 and 8 bring the book to a close, looking at WebGL in productions settings and creating a game.

This is a very short book and often the code is left to do the explaining.  This is not to say that the author doesn't explain  some basic concepts, but there is too much to get through in any detail in a book this size. You will either have to go and find out about some aspects of 3D or be lucky enough to know theory or practice already. As a result this book is great for programmers who have worked with a 3D system before but less so for the 100% complete beginner. And of course there is no point at all in approaching it unless you are fluent in JavaScript and HTML.

As long as you are happy with using Three.js and can accept a fairly compact and advanced approach to 3D graphics, this is a good introduction to graphics based on WebGL and it should get you to the point where you can create your own game or simulation.

Banner


PHP In Easy Steps, 4th Ed

Author: Mike McGrath
Publisher: In Easy Steps
Date: April 2021
Pages: 192
ISBN: 978-1840789232
Print: 1840789239
Kindle: B08ZSV3MNH
Audience: People wanting to learn PHP
Rating: 4
Reviewer: Ian Elliot
PHP isn't a fashionable language, but this doesn't mean it isn't worth learning.



Go Programming Language For Dummies

Author: Wei-Meng Lee
Publisher: For Dummies
Date: April 2021
Pages: 336
ISBN: 978-1119786191
Print: 1119786193
Kindle: B0921HHN48
Audience: People wanting to learn Go
Rating: 4
Reviewer: Mike James
Can a dummy master Go?


More Reviews

Last Updated ( Tuesday, 09 October 2012 )