Three.js

smooth rotation, pan and zoom in three.js

Trackball Controls in three.js

This tutorial explains how to rotate the camera with the mouse in three.js. This can be accomplished using the built-in TrackballControls.js. Test it out on the below. Rotating the object around by holding down the left mouse button and dragging. Zoom with the middle and pan from side to side with the right mouse button. Download the source code for… Read more →

GLSL Displacement Shader in Threejs

Basic GLSL Displacement Shader in Three.js

This tutorial introduces construction a basic GLSL Displacement Shader in Three.js. It can really apply to any GLSL program, but we’ll take advantage of the three.js ability of using custom shaders. If you’re very new to Three.js, please see Creating a Basic Scene in Three.js If you’re confident with the basics you can download the full example files for this… Read more →

Using the Three.js Editor

Using the Three.js Editor

Here are some basics about using the the three.js editor. If you haven’t seen it in action, you can do so here. I couldn’t find any real documentation online about it so figured I’d post about I’ve found from it… The editor comes packaged along with the three.js source code. Let’s download that and open index.html (in the “editor” folder).… Read more →

Smooth Mouse Rotation in Three.js

Smooth Mouse Rotation in Three.js

This example demonstrates Smooth axis rotation via mouse in three.js. Click and drag around in the above. It is based off of this post and this example on the three.js website. Achieving a momentum effect during mouse drag has always been a nice feature that I’ve see many times in different examples of 3D for the web. After experimenting with… Read more →

Orbit Controls in Three.js

Rotate View With the Mouse in Three.js

This example uses “OrbitControls” in three.js to rotate the camera around an object. It’s based off of the example: http://threejs.org/examples/#misc_controls_orbit on the three.js website. We’ve just added a textured cube that’s been imported from Blender. You can take a look at importing a model from Blender then adding a texture here. Note that adding this ability is quite simple because… Read more →

Basic 3d Scene in Three.js

Creating a Basic Scene in Three.js

Here we will create a basic scene complete with an animated transparent cube in three.js. Though most beginner examples on the net show scenes loaded right from an HTML page, we’ll set it up using an external file as it’s generally good practice to keep your .js files separate when dealing with any kind of code that may become more… Read more →