
Join the Conversation!
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
"Please login to view comments"
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
In this chapter, we’ll explore . Even though it might seem simple, planes are used in almost every 3D scene—from floors and walls to floating UI panels and even complex landscapes.
Let’s break it down step by step.
In the world of 3D graphics, a plane is a completely flat shape with width and height but no depth. It’s like a piece of paper or a thin sheet of glass. In , we can create a plane using the class.
const plane = new THREE.PlaneGeometry(width, height, widthSegments, heightSegments);
Each parameter here plays a role in defining the shape of the plane:
If you don’t specify the segment values, will create a single, smooth plane. But increasing these segments will create more divisions, which is useful for animations and detailed textures.
Let’s start by creating a simple plane with a width of 5 and a height of 3:
const plane = new THREE.PlaneGeometry(5, 3);
This will generate a basic rectangular shape. However, it’s just a wireframe for now—it doesn’t have any colors or textures because we haven’t applied a material yet.
You might be wondering:
"If we can't see the plane yet, how do we know it's there?"
Great question! While we haven't introduced materials yet, we can still visualize the plane by using wireframe mode. We’ll discuss materials later, but for now, just trust that this is a handy way to debug your geometries.
Here’s how you can display the plane as a wireframe:
const wireframeMaterial = new THREE.MeshBasicMaterial({ wireframe: true });
const planeMesh = new THREE.Mesh(plane, wireframeMaterial);
scene.add(planeMesh);
Now you should see a simple grid-like structure in your scene.
By default, creates a single, flat shape without any subdivisions. But what happens if we add segments?
const detailedPlane = new THREE.PlaneGeometry(5, 3, 4, 2);
Here, we’ve created a plane that is still 5 units wide and 3 units tall but divided into 4 segments along the width and 2 segments along the height.
These segments are useful when you want to bend, animate, or modify the plane in creative ways. Think of it like a piece of cloth—if it’s divided into many sections, it becomes more flexible.
Let’s visualize the segments using the wireframe technique again:
const wireframePlane = new THREE.Mesh(detailedPlane, wireframeMaterial);
scene.add(wireframePlane);
You’ll notice that the plane is divided into smaller sections. This is useful for creating effects like waving flags, terrain deformation, or smooth lighting transitions.
One thing to remember is that is created facing forward by default. In , that means it lies flat along the X-Y plane but faces the positive Z-axis.
If you want to rotate it, you can use the property:
planeMesh.rotation.x = Math.PI / 2; // Rotates the plane to lie flat on the ground
This is important when setting up floors, ceilings, walls, and other flat surfaces in a 3D world.
Let's put the plane down a little bit in for the better view
planeMesh.position.y = -2;
Now that you’ve created and understood , here are a few challenges you can try:
We haven’t covered materials yet, but in the next modules, we’ll make the plane look more exciting by adding colors, textures, and lighting effects.
Happy coding! 🚀
How did you manage to remove the blur property and reach here?
Upgrading gives you access to quizzes so you can test your knowledge, track progress, and improve your skills.