SlideShare a Scribd company logo
6
Most read
10
Most read
14
Most read
Introduction to three.js
Kou 2021/5/29
Hello, I am Kou
@koko01260126
・Powerful Javascript 3D Library
・You can create animated 3D graphics
・Uses WebGL which allows for access to GPU
What is three.js?
Examples of what you can do with three.js!
https://threejs.org/
How to use three.js?
It’s like playing with Legos.
In essence, we place an object, define a camera, light the
scene and Three.js renders our 3D image.
Light
Configuring three.js is Simple
<html>
<body>
<script src="js/three.js"></script>
<script>
// Our Javascript will go here.
function init() {
}
window.addEventListener("load", init);
</script>
</body>
</html>
Lets Review the Basics of three.js
● Scene
● Camera
● Light
● Geometry (Objects)
● Mesh and Material (Objects)
● Renderer
Scene
● A scene is set in coordinate system (X,Y, Z).
● You place your objects in the scene, such as cubes, cars,
houses, etc.
var scene = new THREE.Scene();
Camera
● A camera is your view port to look at the objects in a
scene.
● Think of looking through the a real camera. You see a
view of the world. This is how your scene will appear.
const camera = new THREE.PerspectiveCamera(40,width / height);
camera.position.set(0, 0, 1000);
Introduction to three.js
Geometry
Geometry refers to the shapes we create.
These are your objects. Three.js support many
geometric shapes to quickly create 3D objects.
const geometry = new THREE.SphereGeometry(300, 30, 30);
Mesh and Material
Material is used to apply texture and color
to an object.
Think of your cube again. You can color each side or apply textures
(.jpg images) to the sides of the cube.
const material = new THREE.MeshStandardMaterial({
color: new THREE.Color("rgb(0, 159, 140)"),
wireframe: true
});
const mesh = new THREE.Mesh(geometry, material);
Light
Lights are used to illuminate a specified
area in a scene.
const ambient = new THREE.AmbientLight(0xffffff, 1);
scene.add(ambient);
const directional = new THREE.DirectionalLight(0xffffff, 1);
directional.position.set(1, 1, 1);
scene.add(directional);
Renderer
Using the WebGL renderer, THREE.WebGLRenderer is used.
// renderer
var renderer = new THREE.WebGLRenderer({
canvas: document.getElementById("mainCanvas")
});
renderer.setClearColor(0x000000);
// render
renderer.render(scene, camera);
My first rolling ball
With three.js
Preview
Thank you!

More Related Content

What's hot (20)

ODP
Introduction to threejs
Gareth Marland
 
PDF
Intro to Three.js
Kentucky JavaScript Users Group
 
PDF
WebGL and three.js
Anton Narusberg
 
PDF
Three.js basics
Vasilika Klimova
 
PPTX
Html5 SVG
Nisa Soomro
 
ODP
Basics of VueJS
Squash Apps Pvt Ltd
 
PDF
Introduction to HTML5
Gil Fink
 
PPTX
An introduction to Vue.js
Pagepro
 
PPTX
React workshop
Imran Sayed
 
PDF
JavaScript - Chapter 3 - Introduction
WebStackAcademy
 
PDF
An introduction to React.js
Emanuele DelBono
 
PPT
Java Script ppt
Priya Goyal
 
PDF
Introduction to weblogic
Vishal Srivastava
 
PDF
ReactJS presentation
Thanh Tuong
 
PPT
Introduction to BOOTSTRAP
Jeanie Arnoco
 
PPTX
Java Servlets
Emprovise
 
PPTX
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
 
PPTX
Vue Vuex 101
LocNguyen362
 
PPT
JQuery introduction
NexThoughts Technologies
 
Introduction to threejs
Gareth Marland
 
WebGL and three.js
Anton Narusberg
 
Three.js basics
Vasilika Klimova
 
Html5 SVG
Nisa Soomro
 
Basics of VueJS
Squash Apps Pvt Ltd
 
Introduction to HTML5
Gil Fink
 
An introduction to Vue.js
Pagepro
 
React workshop
Imran Sayed
 
JavaScript - Chapter 3 - Introduction
WebStackAcademy
 
An introduction to React.js
Emanuele DelBono
 
Java Script ppt
Priya Goyal
 
Introduction to weblogic
Vishal Srivastava
 
ReactJS presentation
Thanh Tuong
 
Introduction to BOOTSTRAP
Jeanie Arnoco
 
Java Servlets
Emprovise
 
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
 
Vue Vuex 101
LocNguyen362
 
JQuery introduction
NexThoughts Technologies
 

Similar to Introduction to three.js (20)

PPTX
COMP340 TOPIC 4 THREE.JS.pptx
Egerton University
 
PDF
Introduction to three.js & Leap Motion
Lee Trout
 
PDF
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
JavaScript Meetup HCMC
 
PDF
ENEI16 - WebGL with Three.js
José Ferrão
 
PDF
Create Basic 3D Scenes Using Three.js
Wednesday Solutions
 
PDF
Augmented reality in web rtc browser
ALTANAI BISHT
 
PPTX
is three.js better for developing web-based 3d games?
DigiPrima Technologies
 
PDF
Creating Applications with WebGL and Three.js
Future Insights
 
PPTX
WebGL - 3D programming
Minh Ng
 
PDF
three.js WebGL library presentation
Yleisradio
 
PDF
140716 : 同業前端聚會分享 - webgl 與 three.js
angelliya00
 
PDF
From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014
Verold
 
PPTX
Interactive 3D graphics for web with three.js, Andrey Vedilin, DataArt
Alina Vilk
 
PPTX
TampereJS June 2018 - Easy 3d drawing with three.js
Jere Kuusela
 
PPT
OWC 2012 (Open Web Camp)
Oswald Campesato
 
PDF
Introducao ao Curso Anselmo Cardoso de Paiva Ufma
AnselmoPaiva1
 
KEY
Leaving Flatland: getting started with WebGL
gerbille
 
PDF
Begin three.js.key
Yi-Fan Liao
 
PPTX
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Saajid Akram
 
PDF
How to make an Earth with Space Background.pdf
fitzmerl duron
 
COMP340 TOPIC 4 THREE.JS.pptx
Egerton University
 
Introduction to three.js & Leap Motion
Lee Trout
 
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
JavaScript Meetup HCMC
 
ENEI16 - WebGL with Three.js
José Ferrão
 
Create Basic 3D Scenes Using Three.js
Wednesday Solutions
 
Augmented reality in web rtc browser
ALTANAI BISHT
 
is three.js better for developing web-based 3d games?
DigiPrima Technologies
 
Creating Applications with WebGL and Three.js
Future Insights
 
WebGL - 3D programming
Minh Ng
 
three.js WebGL library presentation
Yleisradio
 
140716 : 同業前端聚會分享 - webgl 與 three.js
angelliya00
 
From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014
Verold
 
Interactive 3D graphics for web with three.js, Andrey Vedilin, DataArt
Alina Vilk
 
TampereJS June 2018 - Easy 3d drawing with three.js
Jere Kuusela
 
OWC 2012 (Open Web Camp)
Oswald Campesato
 
Introducao ao Curso Anselmo Cardoso de Paiva Ufma
AnselmoPaiva1
 
Leaving Flatland: getting started with WebGL
gerbille
 
Begin three.js.key
Yi-Fan Liao
 
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Saajid Akram
 
How to make an Earth with Space Background.pdf
fitzmerl duron
 
Ad

Recently uploaded (20)

PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
PPTX
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
PPTX
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
PDF
NFPA 10 - Estandar para extintores de incendios portatiles (ed.22 ENG).pdf
Oscar Orozco
 
PPT
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
 
PDF
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
PDF
Tesia Dobrydnia - An Avid Hiker And Backpacker
Tesia Dobrydnia
 
PPTX
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
 
PDF
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
DOCX
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
PPSX
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
PDF
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
PPT
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
PDF
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
 
PPTX
Precooling and Refrigerated storage.pptx
ThongamSunita
 
PDF
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
PDF
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
PDF
Artificial Neural Network-Types,Perceptron,Problems
Sharmila Chidaravalli
 
PPTX
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
NFPA 10 - Estandar para extintores de incendios portatiles (ed.22 ENG).pdf
Oscar Orozco
 
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
 
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
Tesia Dobrydnia - An Avid Hiker And Backpacker
Tesia Dobrydnia
 
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
 
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
 
Precooling and Refrigerated storage.pptx
ThongamSunita
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
Artificial Neural Network-Types,Perceptron,Problems
Sharmila Chidaravalli
 
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
Ad

Introduction to three.js

  • 2. Hello, I am Kou @koko01260126
  • 3. ・Powerful Javascript 3D Library ・You can create animated 3D graphics ・Uses WebGL which allows for access to GPU What is three.js?
  • 4. Examples of what you can do with three.js! https://threejs.org/
  • 5. How to use three.js? It’s like playing with Legos. In essence, we place an object, define a camera, light the scene and Three.js renders our 3D image.
  • 7. Configuring three.js is Simple <html> <body> <script src="js/three.js"></script> <script> // Our Javascript will go here. function init() { } window.addEventListener("load", init); </script> </body> </html>
  • 8. Lets Review the Basics of three.js ● Scene ● Camera ● Light ● Geometry (Objects) ● Mesh and Material (Objects) ● Renderer
  • 9. Scene ● A scene is set in coordinate system (X,Y, Z). ● You place your objects in the scene, such as cubes, cars, houses, etc. var scene = new THREE.Scene();
  • 10. Camera ● A camera is your view port to look at the objects in a scene. ● Think of looking through the a real camera. You see a view of the world. This is how your scene will appear. const camera = new THREE.PerspectiveCamera(40,width / height); camera.position.set(0, 0, 1000);
  • 12. Geometry Geometry refers to the shapes we create. These are your objects. Three.js support many geometric shapes to quickly create 3D objects. const geometry = new THREE.SphereGeometry(300, 30, 30);
  • 13. Mesh and Material Material is used to apply texture and color to an object. Think of your cube again. You can color each side or apply textures (.jpg images) to the sides of the cube. const material = new THREE.MeshStandardMaterial({ color: new THREE.Color("rgb(0, 159, 140)"), wireframe: true }); const mesh = new THREE.Mesh(geometry, material);
  • 14. Light Lights are used to illuminate a specified area in a scene. const ambient = new THREE.AmbientLight(0xffffff, 1); scene.add(ambient); const directional = new THREE.DirectionalLight(0xffffff, 1); directional.position.set(1, 1, 1); scene.add(directional);
  • 15. Renderer Using the WebGL renderer, THREE.WebGLRenderer is used. // renderer var renderer = new THREE.WebGLRenderer({ canvas: document.getElementById("mainCanvas") }); renderer.setClearColor(0x000000); // render renderer.render(scene, camera);
  • 16. My first rolling ball With three.js Preview

Editor's Notes

  • #4: Explain what is WebGL and why not WebGL a little bit WebGL uses HTML5 <canvas> element to get 3D graphics into the browser page.
  • #5: Show same examples here
  • #8: You can use Three.js in any way you could use <canvas>, including full-screen animations, so long as the device supports WebGL. Download Three.js Place it on your server Reference it in your JS src.
  • #10: — basically, anything you can imagine — just like a scene in a film.
  • #11: You can move the camera to look around. Just like in the real world.
  • #15: Think of it like pointing a torch in a particular direction. Three.js simplifies lighting image your in a dark room and you have one light.