O'Reilly logo

Learning Three.js – the JavaScript 3D Library for WebGL - Second Edition by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Materials you can use for a line geometry

The last couple of materials we're going to look at can only be used on one specific geometry: THREE.Line. As the name implies, this is just a single line that only consists of vertices and doesn't contain any faces. Three.js provides two different materials you can use on a line, which are as follows:

  • THREE.LineBasicMaterial: The basic material for a line allows you to set the colors, linewidth, linecap, and linejoin properties
  • THREE.LineDashedMaterial: This has the same properties as THREE.LineBasicMaterial but allows you to create a dash effect by specifying dash and spacing sizes

We'll start with the basic variant and after that look at the dashed variant.

THREE.LineBasicMaterial

The materials available ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required