From Wikipedia, the free encyclopedia
  (Redirected from Threejs)
Jump to navigation Jump to search
Three.js Icon.svg
Original author(s)Ricardo Cabello (Mr.doob)
Developer(s)Three.js Authors[1]
Initial releaseApril 24, 2010; 12 years ago (2010-04-24)[2]
Stable release
r140 / April 30, 2022; 24 days ago (2022-04-30)[3]
Written inJavaScript
TypeJavaScript library

Three.js is a cross-browser JavaScript library and application programming interface (API) used to create and display animated 3D computer graphics in a web browser using WebGL. The source code is hosted in a repository on GitHub.[4]


Three.js allows the creation of graphical processing unit (GPU)-accelerated 3D animations using the JavaScript language as part of a website without relying on proprietary browser plugins.[5][6] This is possible due to the advent of WebGL,[7] a low-level graphics API created specifically for the web.[8]

High-level libraries such as Three.js or GLGE, SceneJS, PhiloGL, and many more make it possible to author complex 3D computer animations for display in the browser without the effort required for a traditional standalone application or a plugin.[9]


Three.js was first released by Ricardo Cabello on GitHub in April 2010.[2] The origins of the library can be traced back to his involvement with the demoscene in the early 2000s.[10] The code was originally developed in the ActionScript language used by Adobe Flash, later being ported to JavaScript in 2009. In Cabello's mind, there were two strong points that justified the shift away from ActionScript: Firstly, JavaScript provided greater platform independence. Secondly, applications written in JavaScript would not need to be compiled by the developer beforehand, unlike Flash applications.

Additional contributions by Cabello include API design, CanvasRenderer, SVGRenderer, and being responsible for merging the commits by the various contributors into the project.

With the advent of WebGL, Paul Brunt was able to implement the new rendering technology quite easily as Three.js was designed with the rendering code as a module rather than in the core itself.[11] Branislav Uličný, an early contributor, started with Three.js in 2010 after having posted a number of WebGL demos on his own site. He wanted WebGL renderer capabilities in Three.js to exceed those of CanvasRenderer or SVGRenderer.[11] His major contributions generally involve materials, shaders, and post-processing.

Soon after the introduction of WebGL 1.0 on Firefox 4 in March 2011, Joshua Koo came on board. He built his first Three.js demo for 3D text in September 2011.[11] His contributions frequently relate to geometry generation.

Three.js has over 1500 contributors on GitHub.[12]


Three.js includes the following features:[13]

  • Effects: Anaglyph, cross-eyed, and parallax barrier.
  • Scenes: add and remove objects at run-time; fog
  • Cameras: perspective and orthographic; controllers: trackball, FPS, path and more
  • Animation: armatures, forward kinematics, inverse kinematics, morph, and keyframe
  • Lights: ambient, direction, point, and spot lights; shadows: cast and receive
  • Materials: Lambert, Phong, smooth shading, textures, and more
  • Shaders: access to full OpenGL Shading Language (GLSL) capabilities: lens flare, depth pass, and extensive post-processing library
  • Objects: meshes, particles, sprites, lines, ribbons, bones, and more - all with Level of detail
  • Geometry: plane, cube, sphere, torus, 3D text, and more; modifiers: lathe, extrude, and tube
  • Data loaders: binary, image, JSON, and scene
  • Utilities: full set of time and 3D math functions including frustum, matrix, quaternion, UVs, and more
  • Export and import: utilities to create Three.js-compatible JSON files from within: Blender, openCTM, FBX, Max, and OBJ
  • Support: API documentation is under construction. A public forum and wiki is in full operation.
  • Examples: Over 150 files of coding examples plus fonts, models, textures, sounds, and other support files
  • Debugging: Stats.js,[14] WebGL Inspector,[15] Three.js Inspector[16]
  • Virtual and Augmented Reality via WebXR[17]

Three.js runs in all browsers supported by WebGL 1.0.

Three.js is made available under the MIT License.[1]


The following code creates a scene and adds a camera and cube to the scene. Next, it creates a WebGL renderer and appends its viewport to the body of the webpage document. Once Three.js has finished loading, the cube rotates about its x and y axes.

import * as THREE from 'three';

// init

const camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
camera.position.z = 1;

const scene = new THREE.Scene();

const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
const material = new THREE.MeshNormalMaterial();

const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );

const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animation );
document.body.appendChild( renderer.domElement );

// animation

function animation( time ) {

	mesh.rotation.x = time / 2000;
	mesh.rotation.y = time / 1000;

	renderer.render( scene, camera );


See also[edit]


  1. ^ a b c "Three.js/license". Retrieved 20 May 2012.
  2. ^ a b "First commit". Retrieved 20 May 2012.
  3. ^ "Releases · mrdoob/three.js · GitHub". Retrieved 11 March 2021.
  4. ^ Mr.doob (2021-03-04), mrdoob/three.js, retrieved 2021-03-04
  5. ^ O3D
  6. ^ Unity (game engine)
  7. ^ "Khronos Releases Final WebGL 1.0 Specification". Khronos Group. March 3, 2011. Retrieved 2 June 2012.
  8. ^ "WebGL". The Khronos Group. 2011-07-19. Retrieved 2022-01-22.
  9. ^ Crossley, Rob (11 January 2010). "Study: Average dev costs as high as $28m". Intent Media Ltd. Archived from the original on 13 January 2010. Retrieved 2 June 2012.
  10. ^ NVScene. "NVScene 2015 Session: Reinventing The Wheel - One Last Time (Ricardo Cabello)". YouTube.
  11. ^ a b c "Three.js White Paper". 2012-05-21. Retrieved 2013-05-09.
  12. ^ Mr.doob (2020-08-03), mrdoob/three.js, retrieved 2020-08-03
  13. ^ mrdoob (2012-11-26). "Features mrdoob/three.js Wiki GitHub". Retrieved 2013-05-09.
  14. ^ "Stats.js". Retrieved 2013-05-09.
  15. ^ "WebGL Inspector". Retrieved 2013-05-09.
  16. ^ "Three.js Inspector Labs". Retrieved 2013-05-09.
  17. ^ "three.js examples".

Further reading[edit]

External links[edit]