In this article, we’ll go through how to place a 3D object in a scene, set up the lighting and a camera, and render the scene on a canvas.
If you have ever wanted to build a game with JavaScript, you might have come across Three.js.
Three.js is a library that we can use to render 3D graphics in the browser. The whole thing is in JavaScript, so with some logic you can add animation, interaction, or even turn it into a game.
In this tutorial, we will go through a very simple example. We’ll render a 3D box, and while doing so we’ll learn the fundamentals of Three.js.
Three.js uses WebGL under the hood to render 3D graphics. We could use plain WebGL, but it’s very complex and rather low level. On the other hand, Three.js is like playing with Legos.
So let’s see how we can do all this.
#javascript #thressjs #developer