118,013
stars
+91
36,936
forks
2,517
watchers
21,213
prs
13,930
issues
179
releases
0
discussions
README
three.js
[![NPM Package][npm]][npm-url]
[![Build Size][build-size]][build-size-url]
[![NPM Downloads][npm-downloads]][npmtrends-url]
[![jsDelivr Downloads][jsdelivr-downloads]][jsdelivr-url]
[![Discord][discord]][discord-url]
JavaScript 3D library
The aim of the project is to create an easy-to-use, lightweight, cross-browser, general-purpose 3D library. The current builds only include WebGL and WebGPU renderers but SVG and CSS3D renderers are also available as addons.
Examples —
Docs —
Manual —
Wiki —
Migrating —
Questions —
Forum —
Discord
Usage
This code creates a scene, a camera, and a geometric cube, and it adds the cube to the scene. It then creates a WebGL renderer for the scene and camera, and it adds that viewport to the document.body element. Finally, it animates the cube within the scene for the camera.
javascript
import as THREE from 'three';
const width = window.innerWidth, height = window.innerHeight;
// init
const camera = new THREE.PerspectiveCamera( 70, width / height, 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( width, height );
renderer.setAnimationLoop( animate );
document.body.appendChild( renderer.domElement );
// animation
function animate( time ) {
mesh.rotation.x = time / 2000;
mesh.rotation.y = time / 1000;
renderer.render( scene, camera );
}
If everything goes well, you should see this.
Cloning this repository
Cloning the repo with all its history results in a ~2 GB download. If you don't need the whole history you can use the depth parameter to significantly reduce download size.
sh
git clone --depth=1 https://github.com/mrdoob/three.js.git
Change log
Releases
[npm]: https://img.shields.io/npm/v/three
[npm-url]: https://www.npmjs.com/package/three
[build-size]: https://badgen.net/bundlephobia/minzip/three
[build-size-url]: https://bundlephobia.com/result?p=three
[npm-downloads]: https://img.shields.io/npm/dw/three
[npmtrends-url]: https://www.npmtrends.com/three
[jsdelivr-downloads]: https://data.jsdelivr.com/v1/package/npm/three/badge?style=rounded
[jsdelivr-url]: https://www.jsdelivr.com/package/npm/three
[discord]: https://img.shields.io/discord/685241246557667386
[discord-url]: https://discord.gg/56GBJwAnUSTop issues
#5524Loaders74 comments · 2014-10-27#14161Add shadow map support for RectAreaLights (brainstorming, R&D)62 comments · 2018-05-28#28776Significant Performance Drop and High CPU Usage with BatchedMesh52 comments · 2024-07-01#30560WebGPURenderer: Current UBO system has severe performance issues with many render items.50 comments · 2025-02-19#9373Compress RectAreaLight BRDF Data and include in three.js build files48 comments · 2016-07-21#4903CSS based size by default?41 comments · 2014-06-09#18565Seams with normal map and mirrored uvs37 comments · 2020-02-06#10600The shadow of a partially transparent object35 comments · 2017-01-18
Latest release
r187 r187 2026-10-30https://github.com/mrdoob/three.js/wiki/Migration-Guide186--187 https://github.com/mrdoob/three.js/milestone/100?closed=1 - Global - Remove code deprecated in r177. 34517 (@linbingquan, @Mugen87) - AnimationUtils - Fix cubic spline additive reference sampling. 34860 (@gjija) - Backend - Keep occlusion query results per camera. 35066 (@arodic, @claude) - BatchedMesh - Clarify geometry compatibility requirements. 34675 (@MikeFernandez-Pro, @Mugen87) - Fix sort corruption. 34828 (@Mugen87) - Make shadows more node compatible. 34829 (@Mugen87) - Fix draw ranges after se
相关报道 (6)
CSDNGitHub热榜解读:实时地球与AI编码代理的2026风向标2026-11-09CSDN实时地球与AI编码代理:GitHub热榜双雄技术拆解2026-11-08OSCHINA399 美元的鸭子机器人开源了,今年最让人想立刻掏钱的硬件产品2026-09-01电子工程专辑EE Times China一个GitHub项目,凭什么让全球数百万人围观?这款3D情报工具太强了2026-03-0651CTOVue3 + Three.js 首款 3D 数字孪生编辑器!正式开源!2025-06-30Pasquale Pillitteri网页正在改变:用 Three.js 和 WebGL 在浏览器中打造 3D 体验与游戏2024-10-31
News & coverage (13)
Hacker NewsThree.js Shading Language▲ 160 · 47 comments · 2024-05-29Hacker NewsPR converts the Three.js codebase to ES2015 modules▲ 134 · 38 comments · 2016-07-23Hacker NewsThree.js: Javascript 3D engine▲ 118 · 17 comments · 2010-04-25Hacker NewsThree.js: JavaScript 3D engine for canvas, svg, and WebGL▲ 93 · 25 comments · 2010-09-20Hacker NewsMrdoob on "What were you hoping to achieve with Three.js"▲ 5 · 0 comments · 2012-05-22Hacker NewsMaking the world better commit by commit▲ 3 · 0 comments · 2024-11-07Hacker NewsFast JavaScript Base64 decode is 2x faster, 3x smaller than JSON.Parse.▲ 3 · 0 comments · 2013-05-01Startup FortuneThree.js r187 shows the browser is now a serious home for 3D graphics2026-10-31https://vr.org/Google Built a Three.js Compiler Because It Does Not Trust the Code an AI Writes2026-11-04Google Open Source BlogIntroducing Three-Live: turning AI-generated Three.js into interactive 3D, AR, and WebXR across web and mobile2026-11-03