Three.js: Difference between revisions
Created page with "{{Infobox software | name = Three.js | screenshot = File:Three.js-code-example.jpg | caption = Screen captures of Three.js examples | author = Ricardo Cabello (Mr.doob) | deve..." |
No edit summary |
||
Line 9: | Line 9: | ||
| latest release date = {{Start date and age|2019|08|28}} | | latest release date = {{Start date and age|2019|08|28}} | ||
| programming language = [[JavaScript]] | | programming language = [[JavaScript]] | ||
| genre = [[JavaScript library]] | | genre = [[JavaScript library]] | ||
| license = [[MIT License|MIT]]<ref name="license" /> | | license = [[MIT License|MIT]]<ref name="license" /> | ||
Line 15: | Line 14: | ||
}} | }} | ||
A very useful graphics library which uses WebGL. | A very useful JavaScript graphics library which uses WebGL build by Mr. Doob (Ricardo Cabello, Google). | ||
[http://threejs.org | |||
* [http://threejs.org threejs.org] | |||
==Getting Started== | |||
# Install <code>three</code> using npm: | |||
#:<pre> | |||
#::npm i three</pre> | |||
# Import into your main JS script | |||
#:<syntaxhighlight lang="js"> | |||
import * as THREE from 'three'; | |||
// or const THREE = require('three');</syntaxhighlight> | |||
You can import specific components from examples as follows: | |||
<syntaxhighlight lang="js"> | |||
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js'; | |||
import {Stats} from 'three/examples/jsm/libs/stats.module.js'; | |||
</syntaxhighlight> | |||
==Instancing== | |||
See [https://threejs.org/examples/?q=instancing#webgl_instancing_performance instancing example]. | |||
There are two main ways of instancing in three.js: | |||
* Using an [https://threejs.org/docs/#api/en/objects/InstancedMesh InstancedMesh] | |||
* Merging geometries (since we don't have a geometry shader) | |||
==Shaders== | |||
See [https://threejs.org/docs/#api/en/materials/ShaderMaterial ShaderMaterial]. |
Revision as of 13:15, 4 June 2020
![]() 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 |
A very useful JavaScript graphics library which uses WebGL build by Mr. Doob (Ricardo Cabello, Google).
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.
- ↑ 1.0 1.1 <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>"Three.js/license". github.com/mrdoob. Retrieved 20 May 2012.
- ↑ <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>"First commit". github.com/mrdoob. Retrieved 20 May 2012.