Atlaslog
Atlaslog / three.js / API reference / LineBasicMaterial
three.js · API reference

LineBasicMaterial

Quick answer

LineBasicMaterial renders Line, LineLoop, and LineSegments with an unlit color, optional vertex colors, and opacity. It is the default line material and is cheap, but linewidth above 1 is ignored on nearly every WebGL platform unless you switch to an addon wide-line material.

Last verified 2026-11-03 · three.js 0.160.0 · Cite this page
new THREE.LineBasicMaterial ( parameters )
Key points
Example
const geometry = new THREE.BufferGeometry().setFromPoints([
  new THREE.Vector3(-5, 0, 0),
  new THREE.Vector3(0, 3, 0),
  new THREE.Vector3(5, 0, 0)
]);

const material = new THREE.LineBasicMaterial({
  color: 0x4aa3df,
  transparent: true,
  opacity: 0.9
});

const line = new THREE.Line(geometry, material);
scene.add(line);
import { Line2 } from 'three/addons/lines/Line2.js';
import { LineGeometry } from 'three/addons/lines/LineGeometry.js';
import { LineMaterial } from 'three/addons/lines/LineMaterial.js';

const lineGeometry = new LineGeometry();
lineGeometry.setPositions([-5, 0, 0, 0, 3, 0, 5, 0, 0]);

const lineMaterial = new LineMaterial({
  color: 0x4aa3df,
  linewidth: 3,          // 单位是像素
  worldUnits: false
});
lineMaterial.resolution.set(window.innerWidth, window.innerHeight);

const thick = new Line2(lineGeometry, lineMaterial);
thick.computeLineDistances();
scene.add(thick);
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). LineBasicMaterial. https://www.jingweizhi.com/en/three/api/line-basic-material.html (accessed 2026-11-03).