O'Reilly logo

Three.js Essentials by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a city from scratch

So far we've just created a terrain. In this small section, we'll show you how you can get started with creating a complete procedural city. We won't show you all the details here, but enough to get started. The goal for this section is shown in the following screenshot (05.04-Simple-3D-Buildings.html):

Creating a city from scratch

As you can see in this screenshot, we're going to create a number of skyscrapers that we randomly position. Let's walk through the code to accomplish this. The basic steps are as follows:

function createCity(buildingCount, rangeX, rangeY, scale) { // create the basic building block ... // Disable the texture for the roof ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required