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


The C# Workshop (Packt)

Author: Jason Hales, Almantas Karpavicius and Mateus Viegas
Publisher: Packt
Date: September 2022
Pages: 780
ISBN: 978-1800566491
Print: 1800566492
Kindle: ‎ B0BGRBDJLS
Audience: C# developers
Rating:  4
Reviewer: Mike James
C# is not the language it once was - time for a revival?



Computer Concepts And Management Information Systems

Author:  C.P Gupta and K. K. Goyal
Publisher: Mercury Learning
Pages: 250
ISBN:978-1683925866
Print:1683925866
Kindle: B08CVSHKG3
Audience: General
Rating: 3
Reviewer: Kay Ewbank

This book is an introduction to the basics of what a computer is, what software is, and what management information syste [ ... ]


More Reviews

Last Updated ( Tuesday, 09 October 2012 )