In this tutorial I’ll take you through the process of quickly creating a textured city in 3d studio max 2009 and how you, through a few extra render passes, can go from a quite crappy render to something half-way decent using After Effects CS3. If all goes well, we’ll end up with a finished shot not too far from the left side of clip above. In part 1 I’ll cover the creation of the city in max and in part 2 we’ll jump over to After Effects for the compositing.
1. Creating buildings
Create a few buildings in 3ds max or use the max file provided in this tutorial.
[tip]Download tutorial max file (42 KB)[/tip]
The more buildings you create, the more diversity you’ll get in your cityscape. (Shocking, isn’t it?) Make sure the pivot points of all buildings are placed at ground level.
Lastly, you’ll end up with a total building count round 3000 so low poly is probably a good idea if you don’t have a very fast system.
2. Particle Flow
Create a plane and name it CityEmitter. The buildings you created in the previous step will be distributed across this plane.
Next, go to the Create tab, choose Particle Systems from the drop-down menu and choose PF Source.
Place the PF Source anywhere in your scene. The position is not important.
Under Emission, set Viewport Quantity Multiplier to 100% so you’ll be able to see all buildings in the viewport.
Then, under Setup, press the Particle View button. When you open Particle View you’ll get what’s called a Standard Flow which is basically a list of controllers that control birth, position, speed, rotation and shape of the particles. You also have control over how the particles will be displayed in the viewport and during render. Near the bottom is a list over all available controllers.
We’ll now start by adding one of our buildings to the scene:
As we don’t want buildings to pop out of the ground during animation, all particles should appear simultaneously. We’ll therefore set Emit Start and Emit Stop to the same frame. I’ll set both to -1 to make sure the buildings are in place before animation starts at frame 0. In my case I want 250 buildings and consequently set the Amount to 250.
As you can see, this gave us 250 particles emitting from the PF Source icon.
To attach the particles to the plane instead, we’ll need to replace Position Icon in the controllers list with something else called Position Object. To do this, find the Position Object controller in the list of available controllers and drag it on top of the Position Icon controller in the view above. Let go when a red line appears over the Position Icon, meaning it’ll be replaced by what you’re dragging in.
Having selected the newly created Position Object, you can now press the button called By List under Emitter Objects which brings up a window where yo can select an Emitter Object. Choose the plane you created earlier called CityEmitter.
This randomly distributes the particles across the plane.
However, if you scrub through the time line, you’ll notice that the particles falls away from the plane which to state it mildly is less than ideal. To fix this, simply check the box called Lock On Emitter and the particles will stay in position.
This is all good of course, but at this point the particles are placed completely random and in a city with streets, this isn’t very realistic. To fix this, you first need to create a black & white material for the CityEmitter. Light areas will receive the highest density of particles while completely dark areas will receive none. In the example, I’ve combined the procedural textures Tiles and Gradient Ramp to create a texture, but you could also paint one in Photoshop or similar to get a more organic distribution map.
Back in Particle View and still under Position Object, scroll down to Location and check the box called Density By Material. The particles are now concentrated in the lighter areas.
To make sure the buildings don’t stand on top of each other also check Separation and play with the Distance until the particles have some space between them.
Buildings really shouldn’t move around that much, so the speed controller is useless here. Right click it and choose Delete.
Now we’re going to replace the rather boring-looking ticks with the actual building. Clicking on the Shape controller doesn’t give us a whole lot of options so we clearly need another one: Shape Instance. Replace Shape with Shape Instance the same way you replaced Position Icon above.
Then, with Shape Instance selected, press the button called None under Particle Geometry Object and choose a building by pressing H on the keyboard. I’ll pick my SkyScraper object.
Aaaand, voila! Nothing happened! This is because the Display settings below are still set to Ticks. Quickly select Display in the list and choose Geometry from the Type drop down menu. We now have buildings, though their rotation might be a tiny bit off. We’ll look into that soon.
Go back to Shape Instance and adjust Scale and Variation according to your preferences. I’ll keep Scale at 100% and set Variation to 25% to vary the landscape a little bit.
Select the Rotation option from the list. As you can see, it’s set to Random 3D which explains why practically no building is standing upright. From the drop down menu, choose Random Horizontal to only make the buildings rotate around their Z axis.
If you don’t wish the buildings to be rotated at all, right-click the Rotation controller in the list and choose Delete.
2.6 Adding more buildings
All that remains now is to add the rest of the buildings. Fortunately, this is a very simple process. In Particle View, select the box called Event01, right-click it and choose Copy. Then right-click somewhere else in the same window and choose Paste.
Then hook the new Event to the PF Source.
Now, you only need to change a few parameters to have your new building in place. First go to Birth and set the number of buildings you want. This time I want 750.
Then go to Position Object to change the position of the new building so they won’t be positioned in the same spots as the previous ones. Scroll down to the bottom of the list and under Uniqueness press the New button to generate a random Seed number.
Finally, under Shape Instance, choose a new building by pressing the button under Particle Geometry Object, pressing H on the keyboard and selecting a new object from the list. I’ll choose Rubble. Then play around with Scale and Variation once more until you’re satisfied.
Repeat paragraph 2.6 until all buildings are scattered on the emitter. I chose 500 OfficeBuildings and 50 IntactSkyScrapers.
3. Finishing the scene
As you probably don’t want your ground texture to look like the distribution map, you need to hide the CityEmitter and use a plane with another texture instead. The easiest way is to select the CityEmitter, press Ctrl+V to duplicate it and choose Instance. Name the new plane Ground.
Then press H on the keyboard, choose CityEmitter and press OK. Right-click the plane and choose Hide Selection. You are now free to apply which ever texture you like to the Ground plane. I chose my very simple Rubble texture.
Now you just need to add some basic lighting and a moving camera and you’re ready to proceed to rendering. For lighting I suggest a single direct light with a mental ray Shadow Map for shadows.
As mentioned above, we’ll use mental ray for this tutorial, so the first thing to do is to enable the mental ray Renderer. Press F10 on the keyboard to open the Render Setup window and under the Common tab, scroll down to the bottom to the Assign Renderer section and press the button next to Production. Choose mental ray Renderer from the list. Next, scroll up again to set your resolution. In this example I’m using 640*360, but you are of course free to choose whatever resolution fits your needs. Next, set your frame range, 0-100 in my example, and choose a place for saving your rendered files. I suggest creating a render folder as you’ll end up with quite a few files. The file format we’ll use is Targa Image File with the following settings:
Still in the Render Setup window, proceed to the Indirect Illumination tab and make sure Enable Final Gather, Caustics and Global Illumination are all turned off.
Then proceed to the Render Elements tab. You’ll need three additional render passes for this tutorial: A Matte to separate the city from the sky so we can do an effective sky replacement, an Occlusion Pass to fake global illumination and a Z Depth Pass to be able to add an atmospheric effect and some depth of field.
4.1 Occlusion Pass
Press the Add … button and choose mr Shader Element from the list.
Name the pass Occlusion and under Parameters press the button next to Shader to add a new shader. Choose Ambient/Reflective Occlusion from the list. There are a lot of settings to play with to tweak the Ambient/Reflective Occlusion shader, but the standard settings, although a little rough, will do just fine for this tutorial.
This basically renders a pass of the scene where this texture is applied to all geometry.
4.2 Z Depth pass
Press the Add … button again and this time choose Z Depth.
The Z Depth pass produces an image where the geometry close to the camera is displayed in white while geometry further away gets darker and darker until it reaches a cut-off point and everything behind it is rendered as black.
Under Z Depth Element Parameters you need to set a cut-off point for where the image goes entirely white or entirely black. In the example scene a Z Min value of 0 and a Z Max value of 2000 works out quite nice as the city plane is 2000 units wide and the camera is looking at the city from one end of the plane.
This might need some tweaking though, so I suggest doing a couple of test renders of still frames before rendering the final sequence.
Press the Add … button for the third time and this time choose Matte.
A matte lets you isolate an object in a scene by making the desired object appear as white while everything else is black. In this case we wish to separate the city from the sky and therefore wish the whole city to appear white against a black background. The quickest way to do this is to under Matte Texture Element enable Material ID and set it to 0. All textures in 3ds max has their Material ID set to zero by default and hence every textured object in the scene (should be all objects) will appear white on the render.
Finally, check and double-check your settings and have that cup of coffee while waiting for the render to finish.
This is it for part 1. I’m a beginner at writing tutorials, but hope it wasn’t too long and painful. Anyway, this should keep your computer nice and busy for a while, depending on your system. If you want to take a peek at my finished file, you can download it below.
[tip]Download finished max file (52 KB)[/tip]
Part 2, concerning After Effects, should be up tomorrow.