Building Modelling

53
1 BUILDING MODELLING TUTORIAL HOW TO BRING 3D WAREHOUSE MODELS INTO CITIESXL Aitortilla01

Transcript of Building Modelling

Page 1: Building Modelling

1

BUILDING MODELLING TUTORIAL

HOW TO BRING 3D WAREHOUSE MODELS INTO CITIESXL

Aitortilla01

Page 2: Building Modelling

2

Introduction Welcome to the ultimate tutorial for noobs! This tutorial has been created with the intention of approaching modeling to people with no experience in programming or modeling. It is a step by step tutorial that takes from many other excellent tutorials put up by other very experienced modders in the XLNation community. Keep in mind that this tutorial is not official; therefore, it is not perfect and there are still many things you will learn with experience and new problems you will have to ask for help to the community. Now, my noob friend, I intend to put in one place all the necessary information to bring your dream buildings into Cities XL! About Google Sketchup and 3DS Max 2008 3DS Max 2008 is a very powerful tool aimed at pros. For noobs who want to create simple models, Google Sketchup is a fairly good alternative. Therefore, this tutorial will explain only how to proceed using Sketchup models. Still, after the model has been done, the rest of the process is the same for both Sketchup and 3DS models. There is bad news, and good news… The bad news is that Sketchup is good only to create models, but after that there is a process that MUST be done in 3DS Max 2008. Therefore, you have to install this software and get acquainted with its basic use. No alternative. The good news is that it is a very mechanical and repetitive process, not difficult to learn. Once you do, you can pick a simple model from the Warehouse in the morning and play with it in CXL in the evening! Follow this tutorial all the way and you will create your FIRST building sooner than you ever imagined!

Page 3: Building Modelling

3

So, what are the steps to bring a model into the game?

1. Create a model in Sketchup or import it from the 3D Warehouse

2. Export it to 3DS Max 2008

3. Map it: create the Diffuse, Normal and Self-Illumination maps

4. Create the different Levels of Detail

5. Export the model to the game! The file extension workflow will be:

Sketchup .3ds 3DS Max .sgbin EasyModXL .patch In this tutorial you will learn what this means and how to do it! However, before you get all hyped, you must do your homework and take a look at these great tutorials posted on XLnation: http://xlnation.net/content/3ds-max-modelling-specification http://xlnation.net/content/how-export-sketchup-model-3ds-max-2008 http://xlnation.net/content/converting-max-file-sgbin?page=1 http://xlnation.net/content/how-put-your-model-game-screencast Also, take your time and follow these series of 21 short videos to understand the basic functions of 3DS Max. They are also quite funny!

http://www.youtube.com/watch?v=KwRkkGzA98k

Don’t be lazy! Do these tutorials and you will understand many things I will explain in this tutorial!

Page 4: Building Modelling

4

Software needed It is a long list but don’t be afraid: Google Sketchup Pro 8 You need the Pro version, the only one that allows you to export your models as .3DS; the Pro costs money. Whether or not you want to get it from other ways is your call. 3DS Max 2008 It has to be the 2008 version, other versions are not compatible with the tool created by Focus to convert the .max files into .sgbin game files; again, it costs money. How you want to get it is your call. Artist Suite Viewer This free tool is the key to convert the .max files from 3DS Max into .sgbin game files; you can download it from the official CXL website, under “tools”. Download the documentation, too, and follow instructions to add the viewer to 3DS Max http://www2.citiesxl.com/index.php?rub=modding Paint.net Very useful to do the textures maps, and free. You won’t need it if you have PhotoShop and have some basic knowledge. http://www.getpaint.net/ PhotoShop If you don’t want paint.net, you can do everything with PhotoShop. However, PS is necessary in my opinion, because we will use it to create the “normal maps” with a special plugin further on. How you want to get it is your call. Nvidia plugin for normal maps This free plugin installs in PhotoShop and allows you to very easily create a “normal map”. Otherwise it’s a long and tedious process. http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop EasyMod XL This new application developed by Hyperwolf allows you to create .patch files very easily with plenty of templates. http://xlnation.net/content/easymod-xl-beta

Page 5: Building Modelling

5

Part One: Creating the Model Choose a model from the 3D Warehouse and download it as .skp. Before you use a model from the 3D Warehouse remember to ask permission to the owner or give due credit when publishing the model. Most modelers will be happy to lend their models to the game, but still appreciate receiving credit. Allright, let’s get started! We will be using the John Hancock Center model for this tutorial, an official model from the Google 3D Warehouse team.

First of all you have to know that Sketchup models are not really ready to be exported to 3DS Max. You have to fix a few little things before that. Make sure you unlock the model (right click>unlock) and explode it if its grouped, delete ground satellite images (if any), display hidden geometries (menu>view) and then try to remove unnecessary lines or objects and any other superfluous elements of your model (trees, flags, cars, etc.). Those unnecessary elements may present a problem later when working with the file in 3DS Max. The rule is to keep the model as simple as possible.

Page 6: Building Modelling

6

However, it is always nice to add some decorations. Here I added a few elements in the rooftop, and modified the antennas (I actually copy pasted them from the Sears Tower model):

Page 7: Building Modelling

7

Important It is unusual to find a good texture that covers the entire façade of your building, especially when doing a skyscraper or a large building. In that case, you have to find new textures on the internet and split the façade of the building like this:

Why? Because it’s better to place several times a small texture of high resolution than one covering the entire façade with one in low resolution. So instead of using one texture for 40 floors, use one of 10 floors, 4 times. However, the John Hancock Center model was good and the texture of the entire building was decent enough to leave the surface as it is. Let’s keep this tutorial simple.

Page 8: Building Modelling

8

Also keep in mind the base of the model. Draw a base with the right size (40m x40m or 60m x 60m for standard sizes, or irregular if needed) and place the model on top of that. Very important, rise that base a few cm. and subdivide it in several smaller squares like this:

This will prove very useful later when texturing the model. If you place your building on top of a normal base, it may happen that it looks invisible in game (that’s why you should raise it like 10cm). And also here you have to subdivide it because if you use one texture for a base so big it will look too pixelated (better place the texture 16 times, high resolution each, than 1, bad resolution)

Page 9: Building Modelling

9

When you think the model is ready, export it as .3ds to a new folder where it will automatically save the model and its textures. In this folder you will save the maps and files.

Close Sketchup, because we are done with it! Now go to the folder where you exported the .3ds model and inspect it: you will see the .3ds file as well as several .jpg files, one for each texture that was used in the Sketchup model. Check the quality of these textures; if they are too small or pixelated, you should find new ones yourself (look in cgtextures.com or find the building in flickr, google images, etc. there will be tons of perspectives and photos) - otherwise they may look really bad in-game. Now let us go for the serious part: open 3DS Max! Tip: You should have learned the very basics of 3DS Max by now by following the tutorials. Remember, it is very important that you watch at least some tutorials. Go to file>import and open the .3ds file you saved from Sketchup. Say “ok” to the first question, “no” to the second.

Page 10: Building Modelling

10

Now your building will appear in a grey color and you may see a funny recording camera floating in the air - just click on it and delete it.

The model will not bring the textures and colors from Sketchup, that’s the whole texturing process that will be covered in the next chapter. Right click on your model, select Convert to > convert to editable poly

Page 11: Building Modelling

11

You will see that the menu on the right changes a little:

Page 12: Building Modelling

12

Now comes the annoying part of using Sketchup models. Click on the arrow you see in the picture and you will see that the model is made up of several groups and subgroups of polygons.

It should look like this…

…but very often it doesn’t. So let’s fix it. Notice the right column that says “faces”. If any of those lines appear as “0” you won’t be able to export the model. So fix that now: Close that window, go to your right menu, scroll down and find “attach”.

Page 13: Building Modelling

13

Click on that small box and that “faces” menu we saw before will open up again. This time you will see the option of attaching all those groups and subgroups. Select several with Ctrl and attach them. Don’t just select everything and hit attach. Select a few at the time. If it says something like, this, just click ok:

Just before the end, it has to look like this:

Page 14: Building Modelling

14

So you click on “model”, “attach”, and it will finally look like this:

If it doesn’t, don’t panic. Undo your last moves and do it again. It cannot say that there is a 0 face. Otherwise you won’t be able to export it. Grouping objects is tricky; if you don’t get it at first keep trying. Now go to the right menu and name it b_ind_model_t3_l1 (assuming that you are doing a skyscraper –> b stands for building, ind for industry, the name of your model, t3 for high density and l1 for level of detail 1)

Now, as usual and as many times as possible, save your file! You can name the .max file anything you want. First part is done; we have our 3ds max file!

Page 15: Building Modelling

15

Part Two: Mapping Now comes the funny part. You will give life to that ugly grey model you just imported. You will see it take shape, you will see whether the textures were good or not, and you will feel the adrenaline rushing as you see your little creation taking shape! The textures are added via “maps”. A map is just a 1024x1024 .png file where you place all the textures that will appear in your model. There are several kinds of maps that can be added to your model. I will focus only on the 3 basic ones:

- Diffuse Map: this is where you will place all the textures of your model.

- Normal Map: also called “bump map;” it is the previous map, after a layer of Photoshop that will add some sort of volume to it.

- Self-illumination Map: the night time map; you darken the Diffuse Map

and add some night illumination textures to it.

Page 16: Building Modelling

16

I. DIFFUSE MAP Before you do this you should take a few minutes to watch Montoto’s UV Mapping tutorial, which is extremely good and useful – and funny, too! http://xlnation.net/content/basic-uv-mapping-screencasttutorial-engesp If you didn’t understand anything the first time, it’s ok. Now we are going to do it step by step and you will see how easy and mechanical it is. Minimize 3DS Max, and open Paint.net Open all the texture files from your model, the ones that were created when you exported your .3ds file from Sketchup or better ones you picked from the web. Also open a new file, size 1024x1024

In this new file you must copy and paste all the textures that you are using for your model as big as possible. It must look like this:

Page 17: Building Modelling

17

You really need to fill all spaces; the larger your textures can be in that file, the better. My example is precisely not the best one, but it did the job! Find a large texture for the ground, several nice for the roof and decorations, and obviously find the best ones you can for the facades! When you are done save that document as .png as follows:

b_ind_model_t3_dif_l1.png Note that we are keeping the same nomenclature but now we added the “dif” part. Keep this precise order for all textures and models, if they don’t match you may have problems exporting the model to the game. Now go back to 3DS Max and hit “m”. Your material window will appear:

Page 18: Building Modelling

18

Each “ball” is where the textures will be applied, and then applied to your model. Don’t worry; you will see it’s easy. Select the first ball, and rename the file like your model b_ind_model_t3_l1:

Now let us add the Diffuse Map. Make sure the first “ball” is selected and a little below you will see the button “diffuse”. Click on the box > open bitmap > open the .png file you just saved from paint.net

Page 19: Building Modelling

19

You will see now that the ball changed to something that looks like your textures.

Page 20: Building Modelling

20

Now you will be in the submenu of that texture, so you need to rename it like you named the Diffuse Map:

Page 21: Building Modelling

21

Good. Now (1) drag the ball and drop it onto your model and (2) hit the blue box that looks like a dice. That will make the textures appear on your model:

It looks ugly and low resolution but is part of the process (later you will see the “render” option to see the model in high resolution, exactly how it would show in game). Ok, so now you will be assigning every polygon of your model to a part of the Diffuse Map. The sides of the building with the façade texture, the ground with the asphalt textures, etc. Go to editable poly > polygon and select a few elements of the building.

Page 22: Building Modelling

22

They will look red:

Now go to the modifier menu and scroll down to “Unwrap UVW”

Page 23: Building Modelling

23

You will see that now this “Unwrap UVW” menu appears on top of your Editable Poly; expand it and click on Face.

Important: by default “Vertex” is selected; remember every time to open this menu and select Face, not Vertex! Click on “Edit” a little further below and this new “Edit UVW” window will appear, where you will see in green the shapes of the polygons you just selected:

Page 24: Building Modelling

24

Open the drop down menu and you will see that your Diffuse Map is there. Select it:

Now you will see as background your Diffuse Map. And the shapes of your

polygons appear on top. Can you see where we are going?

You still need to do two things that you will always have to do: First go to options>preferences:

Page 25: Building Modelling

25

And resize it as 1024x1024:

And second, go to Mapping>Flatten Mapping:

Page 26: Building Modelling

26

Say “ok” to the window that pops up.

Now you see all the polygons you selected, neatly laid out. Your job now is to move those shapes to cover the exact part of the texture you want them to show. You can move them, rotate them, mirror them, expand them, etc. in order to cover the exact part of the texture you want to show. Tip: Repetitive sides of your building, like several facades that are identical, can be done easily by superposing the green shapes one on top of the other, with as much precision as you can. This is useful when you want the facades to match at corners.

Make sure that you zoom in, and place the green polygons exactly where they should be:

Page 27: Building Modelling

27

Now hit the render button and see your progress in high resolution:

Check this constantly to make sure it will look good in-game. No surprises, no mistakes using parts of other textures, the different floors of a building are well aligned, etc. You can check this render anytime you want and just close it when done.

Page 28: Building Modelling

28

So when you are done with the first polygons you just textured, you need to collapse the “Unwrap UVW”, which basically means saving it. Close the “Edit UVW” window, and on the right menu, go to “Unwrap UVW” and right click on it:

Select “Collapse To” and say ok to the pop up message.

Page 29: Building Modelling

29

Now you just have to repeat this process for all the polygons of your model: the facades, the ground, the boxes, antennas, etc. If you are not satisfied, you can modify it any time, just redo the process. Remember the process: Go to Editable Poly > click on polygon > select the polygons in your model that you want to texture > drop down to Unwrap UVW > select FACE (not Vertex) > click on Edit below to open the Edit UVW window > display the Diffuse Map as background > resize it to 1024x1024 > flatten mapping > start dragging the green polygons over the textures > close the window > collapse “unwrap UVW”. Do the same thing again and again. It takes time, but it’s mechanical and repetitive. No secrets. This is the only somewhat complicated part of modeling. After this, the rest is much easier. Tips: When selecting several polygons that are next to each other, they may appear attached in the Edit UVW window:

If you drag one away, you will see that the others are attached to it and it will be a mess. Just click on tools > Break and you will detach them:

Page 30: Building Modelling

30

Now you can move them freely:

Page 31: Building Modelling

31

Important issue! It may happen that after you click on “Flatten Mapping” your green polygons appear all messed up:

Don’t panic. Close the Edit UVW window, collapse the Unwrap UVW and select the polygons again and repeat process. The second time you do, after you flatten them, they will restore and look good. It happens often and it’s very annoying, but not serious. Finally your model should look all detailed and nice:

You are done with the Diffuse Map. The rest is much easier, you will see!

Page 32: Building Modelling

32

II.NORMAL MAP Now minimize 3DS Max and go to Photoshop this time. After you installed the Nvidia plugin this map will be super easy. Open the Diffuse Map; now go to file > tools > NVIDIA Tools > NormalMapFilter

Check or uncheck items so it looks like this:

And accept. It will create a funky-looking map of your texture.

Page 33: Building Modelling

33

You can see some relief and volume. Done! Save it as:

b_ind_model_t3_bp_l1.png Close Photoshop and go back to 3DS Max. Open your textures window (hit “m”). Since you last opened the Diffuse Map, your first ball is displaying the Diffuse data; click in that black pointing upwards arrow and you will go back to the main ball menu:

Page 34: Building Modelling

34

Now scroll down where it says “Maps” and open that menu:

Page 35: Building Modelling

35

You will see several slots for all the maps you could add to your model. Remember we said that to keep this simple we will only use the Diffuse, Normal (Bump) and Self-Illumination maps. It should look like this:

The Diffuse is already selected because it is the one we did before. Now tick on the Bump box, click on “None” and the browser window will pop up. Click on Bitmap and select your Normal map.

Page 36: Building Modelling

36

Do like we did before. Drag and drop the ball onto your model, rename it as b_ind_model_t3_bp_l1 and click on the dice thing to see it displayed. You will see it looks purple now. The good thing is that this is applied to the polygons you did before, so you do not have to worry about doing the Unwrap UVW anymore! Save your model, and minimize 3DS Max. We are going back to Paint.net!

Page 37: Building Modelling

37

III.SELF-ILLUMINATION MAP Last map! This will be funny because it will allow us to be a little more creative. Open the Diffuse Map:

We will add a second layer, paint it black and make it a little transparent. If you are not familiar with layers, the process is: Add a new layer and move it to the first position if it’s not already:

Uncheck the “Background layer”; it will show only layer 2:

Page 38: Building Modelling

38

Paint this layer 2 black.

Double click on “Layer 2” and this new box will appear:

Lower the opacity to 240. You will see now your Background texture through. Now select a part of the texture that you want to appear fully illuminated at night. For example, there is a red texture that was used for the night lights on top of the antennas of the John Hancock. I want them to be bright at night. So select the area where the red is, and hit delete:

Page 39: Building Modelling

39

Now you can see through the black layer and the red appears perfectly. If you applied this map now to your model, the building would look completely dark at night except for the red lights on the antennas. Repeat this process with entrance, logos or names, windows that you want to appear as illuminated at night, etc. Be creative!

Page 40: Building Modelling

40

Another option would be to carefully paste on top of this dark layer company logos or office windows at nighttime. CGtextures.com is a good resource for this. When you are done, save the file as:

b_ind_model_t3_ill_l1.png Go back to 3DS Max, and open your textures window (hit “m”). Repeat the same process: go to Maps > Self Illumination > click on “none” > open bitmap and add the Self-Illumination map. Rename the texture. Drag and drop. Voilà! That was fun, our model is taking shape! Important! In the Material Editor window, when you scroll down you will find a menu called “Monte Cristo Parameters”. Open that menu and select “Building”.

Otherwise your building will look weird in game. Save your .max model!

Page 41: Building Modelling

41

Part Three: LOD’s LOD stands for Level of Detail. The game has four level of details: very low, low, medium and high. They range from lowest resolution and details to the highest. Remember when you started that your model was named b_ind_model_t3_l1; this l1 stands for Level of Detail 1. The guides available at the Cities XL official website explain how many polygons can a building have for every level of detail. A high density office must have maximum 6,000 polygons for the L1 and maximum of 100 for the L4. So, for the L2, L3 and L4 versions of your building you must reduce elements and polygons (boxes, details, flags, etc.) in each copy to reduce its number until 100. If you exceed that number, nothing happens, but many buildings exceeding this number eventually will make the game slower and more lagging. Since the model I used as an example had much less polygons than the maximum, I did not make any reduction for the L4. Besides, the John Hancock Center is intended to be used only once in a city. What the L4 needs is the three texture maps resized to 256x256. Let’s see how to make the L4 and apply those smaller textures. Start by going to Paint.net and open the three textures:

Save each as a new file as: b_ind_model_t3_dif_l1 > b_ind_model_t3_dif_l4.png b_ind_model_t3_bp_l1 > b_ind_model_t3_bp_l4.png b_ind_model_t3_ill_l1 > b_ind_model_t3_ill_l4.png Now resize these new l4 files to 256x256 each and save:

Page 42: Building Modelling

42

Close Paint.net and go back to 3DS Max. Select your model and the “move” icon on the toolbar:

Hold SHIFT and drag the red arrow, the X coordinate. You will see a new building being dragged from the one you had. When you release it, a window will appear:

Page 43: Building Modelling

43

Leave the “Copy” option selected, and rename the new one ending with l4 This process applies for l2 and l3, too. You make a copy of each. In each model you are supposed to delete some elements and thus reduce the number of polygons. Now open the Material Editor (m) and select the second ball:

Same process as before: rename it b_ind_model_t3_l4, and add the three textures, this time the l4 versions that are 256x256. You don’t have to edit the polygons nor Unwrap UVW. Name each texture and remember to select “building” in Monte Cristo Parameters; just like we did for L1.

Page 44: Building Modelling

44

The L4 should ball should look like this:

If you are happy, your model is done! Time to export it!

Page 45: Building Modelling

45

Part Four: Exporting the model

Click on the purple Viewer:

Note that you must have downloaded the Viewer from the Focus website as explained at the beginning of this tutorial (if you haven’t, save your model and close 3DS Max, install the plug, and open again). A new window will open with your building looking in higher resolution.

Click on “save scene” and save it as .sgbin file: b_ind_model_t3.sgbin

Page 46: Building Modelling

46

Now we need to create the thumbnail file that will be displayed in-game. Print screen a good shot from the render and modify it on Paint.net. Add the name of your model to it and resize it 128x128.

Save it using the .DDS extension as b_ind_model_t3.dds

Page 47: Building Modelling

47

Good! Now we have a .sgbin file and a .dds file. The game model extension used, the .PATCH, is made up of four files: a .sgbin, a .dds, a .class and a .layout. .class and .layout are the values of the model (cost, employees, resources needed, etc.) and the elements or furniture that you can add as decoration. Thanks to Hyperwolf’s great EasyModXL it is very easy now to deal with these files and pack them all in a .patch file. Open EasyModXL, and click on File > new project > new project from template This wizard will appear. Select the kind of building you have been doing; in this case high-den office:

Page 48: Building Modelling

48

Now you are edit your base name (b_ind_model_t3) and browse for your .sgbin and .dds files; note that EasyModXL already brings the .class and .layout for that kind of building.

When you are finished, this will appear on the left menu:

If you click on .class and .layout you will be able to edit these parameters. So far you might only need to modify the .class if you wanted to change the base of the model.

Page 49: Building Modelling

49

Try to do buildings that respect these standard sizes and deviate only when necessary. In this case, the John Hancock Center is an exception and I modified the base dimensions from 60m x 60m to 90m x 60m.

Double click on the .layout file, because there is some useless furniture in that model you want to remove. Basically you have to remove every line for each piece of furniture or tree you don’t want showing in your mode. They appear like this: <LayoutEntry> <ID>Furniture</ID> <Type>FURNITURE</Type> <PrototypeFile>data\design\decoration\furniture\suit\f_sui_bench02.class</PrototypeFile> <Position>-2.61143,-18.7554,0.662535</Position> <Rotation>0,0,-0.707107,0.707107</Rotation> </LayoutEntry> Or like this: <LayoutEntry> <ID>Tree01</ID> <Type>TREE</Type> <PrototypeFile>data/design/decoration/tree/no_cultured_tree/t_noc_tungoiltree01.class</PrototypeFile> <Position>-22.5968,-15.555,1.50178</Position> <Rotation>0,0,0.451872,0.892083</Rotation> </LayoutEntry> Remove them all but do not remove the entries named PLUG, JUNCTION or TRACK; those are the ones that act as a connector between your model and the street.

Page 50: Building Modelling

50

Just select them and delete. For more advanced modding, you can add vehicles, people, trees or animations to your model. But for now, we want to keep it simple. When you are ready, click the arrows button on the toolbar:

It will ask you to save changes as .emp file, say yes and save it in your folder. Now save the .PATCH file and name it however you like…

Page 51: Building Modelling

51

…and that’s it! You did it! You have a .patch file now – copy it into your PAK folder and open the game, go to its menu… …and here it is…

Page 52: Building Modelling

52

Page 53: Building Modelling

53

Acknowlegdments:

I want to thank User, Karaaib, Edesa, Discopolis, Altiris and many others who have been patient and helpful enough to make a modeler out of a total noob like me! Special mention to Montoto for his tutorials and to Hyperwolf for putting together this community that will indeed keep Cities XL alive for many years!

Aitortilla01