Creating a custom vertex shader

When you want to create advanced 3D effects with great performance, you can choose to write your own shaders. Shaders are programs that directly affect what your results look like and which colors are used to represent them. A shader always comes as a pair. A vertex shader determines what a geometry will look like, and a fragment shader will determine the resulting color. In this recipe, we'll show you how you can use your own custom vertex shader in Three.js.

Getting ready

WebGL and GLSL, which is the language in which you write shaders, are supported by most modern browsers. So, for this recipe, there aren't any additional steps you need to take before you can walk through this recipe. A good resource on GLSL is ...

Get Three.js Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.