Three.js
A very useful JavaScript graphics library which uses WebGL build by Mr. Doob (Ricardo Cabello, Google).
Screen captures of Three.js examples | |
Original author(s) | Ricardo Cabello (Mr.doob) |
---|---|
Developer(s) | Three.js Authors[1] |
Initial release | April 24, 2010[2] |
Stable release | r108
/ August 28, 2019 |
Repository |
|
Written in | JavaScript |
Engine |
|
Type | JavaScript library |
License | MIT[1] |
Website | threejs |
Getting Started
- Install
three
using npm:- npm i three
- Import into your main JS script
import * as THREE from 'three'; // or const THREE = require('three');
You can import specific components from examples as follows:
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js';
import {Stats} from 'three/examples/jsm/libs/stats.module.js';
Instancing
See instancing example.
There are two main ways of instancing in three.js:
- Using an InstancedMesh
- Merging geometries (since we don't have a geometry shader)
Shaders
See ShaderMaterial.
References
- ↑ 1.0 1.1 "Three.js/license". github.com/mrdoob. Retrieved 20 May 2012.
- ↑ "First commit". github.com/mrdoob. Retrieved 20 May 2012.