successgraph®
Build a 3D product viewerThree.jsLight the RainBlenderThe Seven-Cent ShotAI filmmakingBuild a Cute Cartoon WorldThree.jsThe Seed ShotThree.js

Three.js / JavaScript 9:57

Three.js Tutorial for Beginners: Build a Cute Cartoon World

By SuccessGraph®

Rate this class

Chapters

  1. 0:00The finished Three.js cartoon world
  2. 0:19What you’ll build
  3. 0:52Run the project with Node.js and Vite
  4. 1:30Connect the canvas and WebGL renderer
  5. 2:08Set up the orthographic camera and color
  6. 2:47Render your first frame
  7. 3:06Build the grassy island and props
  8. 4:58Read XYZ coordinates and group the character
  9. 5:36Model cute rabbits from simple shapes
  10. 7:06Add soft lighting and shadows
  11. 8:05Animate the characters with elapsed time
  12. 8:47Make the scene responsive
  13. 9:08Customize the scene and check your work

What you’ll learn

Build a grassy island with animated rabbits in Three.js. Start with a blank canvas, then model the scene, light it, and bring the characters to life.

Set up an orthographic camera, build a low-poly environment and rabbits from simple shapes, and use elapsed time to animate the characters. Make the scene responsive and try your own variations.

Use a desktop browser with WebGL 2, Node.js, and a code editor. Basic JavaScript familiarity helps. The exercise files include a Vite project.

Project resources

Class transcript

English · 13 chapters
▶  0:00

The finished Three.js cartoon world

These two little characters, their island, and the shadows beneath their feet are all made in JavaScript. We’ll start with a pair of cylinders and end with this animated scene running in your own browser.

Welcome to this SuccessGraph tutorial.

▶  0:19

What you’ll build

Open the companion project and keep it beside the video. Each code card shows the part we are discussing. Pause when you want to try a change, and use the build guide for the complete code in order.

We will build this complete cartoon scene from ordinary three.js geometry. Two characters share a grassy island, with trees, flowers, warm light, and gentle motion. Follow the editable companion project as we connect each visible choice to the JavaScript that creates it.

▶  0:52

Run the project with Node.js and Vite

You need a browser with WebGL, Node.js compatible with the bundled Vite version, and basic JavaScript familiarity. From the project folder, install the locked dependencies with npm ci.

Then run npm run lesson and open the local address Vite prints. Before editing any code, make sure you can see the finished project. Run npm ci from the folder with package.json, then run npm run lesson. Keep the terminal open and follow the local address it prints. If the page is blank, check the browser console first.

▶  1:30

Connect the canvas and WebGL renderer

Open lesson main.js. The page already contains a canvas, and this module selects it before creating our world. The imported makeWorld function owns scene construction. Keeping that construction separate lets the browser and video renderer use the same scene.

Inside world.js, create a WebGLRenderer using the supplied canvas. Antialiasing smooths the outlines, while alpha allows the page background to show through. Set its drawing size explicitly.

This project fixes pixel ratio at one to keep rendering cost and video output predictable.

▶  2:08

Set up the orthographic camera and color

Create the scene, then an orthographic camera. Its horizontal bounds include the width to height ratio, preserving proportions across canvas shapes. Place the camera above and beside the island, looking toward character height. This creates the miniature, storybook perspective without perspective size changes.

Set sRGB output for display and use ACES filmic tone mapping to compress bright lighting into the visible image. Exposure controls the overall response. These settings work together with light intensity and material color, so judge their result in the actual rendered scene.

▶  2:47

Render your first frame

Here is the path from code to picture. A mesh belongs to the scene. The camera decides what part of that scene you see. Then the renderer draws the scene through that camera onto the canvas. In the full project, the browser loop calls render for you.

▶  3:06

Build the grassy island and props

Our material helper creates MeshStandardMaterial with high roughness for a matte finish. The palette reuses those materials across the scene: green grass, warm earth, cream and peach characters, and dark facial features.

Shared colors help the different objects feel like one designed world. The mesh helper wraps a repeated task: combine geometry and material, set a position, enable shadow participation, and add the result to a parent. Its default parent is the scene.

Later we supply a character group instead, making positions local to that character. Build the island from two cylinders. The thicker tan one suggests soil, while a thin green one sits above it as turf. Their vertical positions create a visible layered edge. Sixty four radial segments keep the circular silhouette smooth at this camera distance.

Our second helper starts with a unit sphere, then scales width, height, and depth separately. A tall sphere becomes foliage or an ear; a flattened one becomes a foot or cheek. Reusing this construction language gives the scene its soft, rounded visual consistency.

Each tree groups a narrow cylinder trunk with one stretched sphere of leaves. Place two trees behind the characters, using a slightly smaller scale for the second. Their simple outlines establish the island as a landscape while leaving the central character silhouettes easy to read.

The flower loop places a short cylinder stem and a flattened yellow sphere at each coordinate pair. Those repeated accents add scale and rhythm around the island. Edit the coordinate list to rearrange them, keeping the faces and the space between the characters clear.

▶  4:58

Read XYZ coordinates and group the character

Before building the face, read the position arguments as X, Y, and Z. X moves left and right. Y moves up and down. For this character, positive Z points toward the front of the face.

Because the parts share a group, those coordinates move with the character. Inside the character function, create a group and place it on the turf. All body parts become children of that group.

Their positions are local, so scaling or rotating the group transforms the complete character without recalculating every eye, ear, arm, and foot.

▶  5:36

Model cute rabbits from simple shapes

Add the body and head before smaller features. Both are stretched spheres, with the head slightly forward and high enough to read clearly above the body. These large masses determine the character first.

Adjust their proportions before spending time on expression or decorative detail. Use minus one and plus one to mirror the ears. Multiplying horizontal position and rotation by side tilts them outward. Place a pink inner sphere in front of each ear.

This creates an inner surface without textures or complex modeling. Place small dark eyes and flattened pink cheeks on the front of the head, then add the centered nose after the loop.

Their positive depth coordinates keep them visible on the face. Tiny changes in spacing or height can change the expression more than extra geometry. Use elongated spheres for arms and broad flattened spheres for feet. The side multiplier mirrors their positions and arm rotation.

Keep the feet near the group origin so the character sits naturally on the grass. The resulting pose should remain readable even before adding motion. Call the same character builder twice.

The hero uses cream at full scale; the friend uses peach and a smaller scale, with a slightly different position. Reusing the builder keeps the visual language consistent while those few arguments create a clear relationship between the pair.

▶  7:06

Add soft lighting and shadows

The hemisphere light supplies broad sky and ground color, preventing the shaded sides from becoming empty black. A warm directional light defines form and casts the main shadows.

Move its position to change shadow direction, then judge the faces and island together before adjusting intensity. Enable the shadow map, let the key light cast shadows, and remember that the mesh helper already enables casting and receiving.

The shadow camera bounds cover the island. Its map size controls resolution, while a small bias helps reduce surface artifacts. Inspect contact shadows carefully. Compare the same scene before and after the key light and shadows.

Look under the feet first. If the shadows disappear in your experiment, check the renderer, the light, the casting mesh, and the receiving mesh. Then check that the shadow camera covers the island.

▶  8:05

Animate the characters with elapsed time

Inside render, use sine waves to offset vertical position and rotation around stable resting values. Small amplitudes make the motion feel like breathing. The friend has a phase offset and different sway, avoiding mechanical synchronization. Render the scene after updating both characters for that time.

The browser calls tick with a timestamp in milliseconds. Divide by one thousand because the world animation expects seconds, then request another frame. Because motion is calculated from time instead of accumulated frame counts, its speed remains consistent when the browser draws at different frame rates.

▶  8:47

Make the scene responsive

On resize, main calls world resize with the current window dimensions. The world adjusts its orthographic bounds to preserve the island in narrow views, refreshes the projection matrix, and resizes the renderer. Geometry stays intact.

Use dispose when removing the world entirely to release graphics resources.

▶  9:08

Customize the scene and check your work

Try a change with a clear expected result. In world.js, find the hero’s vertical sine wave and halve the number after the multiplication sign. Save, then watch both characters.

The hero should travel half as far, at the same speed, while the friend moves as before. Keep the lesson running and make one deliberate change at a time. Try another palette, shorter ears, or a quieter sway, then inspect the result from the camera. Check narrow windows, contact shadows, and animation on your target device.

You now control the complete little world. Thanks for watching. If you enjoyed this video, subscribe to SuccessGraph for more.