The subtract function

Before we start with the subtract function, there is one important step you need to keep in mind. These three functions use the absolute position of the mesh for calculations. So, if you group meshes together or use multiple materials before applying these functions, you'll probably get strange results. For the best and most predictable result, make sure you're working with ungrouped meshes.

Let's start by demonstrating the subtract functionality. For this, we've provided an example, 08-binary-operations.html. With this example, you can experiment with the three operations. When you first open the example on binary operations, you'll see something like the following start screen:

There are three wireframes: a cube ...

Get Learn Three.js - Third Edition 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.