Friday, September 01, 2006

[Last update : November 2, 2006]

Creating Custom Scenery Objects with Blender
A tutorial


The following tutorial is a step-by-step tutorial to create custom scenery objects (CSOs) for RCT3 using the free 3D modelling programme Blender. It also provides general information and links to pages offering more detailed explanations. It goes without saying that it makes no pretension to being THE best and only method, but simply the result of my little experience with Blender and Jonwil’s Object Importer. So don’t hesitate to help me improve this tutorial by adding your own comments.

Note This tutorial is not about how to use Blender. You can find hundreds of tutorials on the net, some of which are designed for beginners (see references below and have a look at my second tutorial, "Model, Texture and Import a 3H Wall into RCT3"). Blender’s interface and functionalities can be daunting at first sight, but don’t panic, you only need to know the basic functions related to the creation of meshes (Editing) and UV mapping. First concentrate on the interface itself (the different views, the menus, etc.) and then try to create simple meshes following a tutorial. You can ignore the Shading functions since you won’t need them to model CSOs.





The tools you need beforehand


  • one of the lastest versions of Blender to model your 3D objects and map textures to them. Get it here for free.

  • an image manipulation programme such as the Gimp. Get it here for free.
  • an ASE converter script to convert .blend files into .ase files (a data format required by Jonwil’s Importer). Get it here. (right-click, Save Target As and choose the following directory "C:\Program Files\Blender Foundation\Blender\.blender\scripts") Many thanks to Belgabor and Vodhin for hosting it.
  • the latest version of Jonwil’s Object Importer. Get it here for free.

Note Instead of the ASE script, you can also use the free converter Biturn (which you can get here for free) but it requires an additional step : first export your .blend file into an .obj file and then convert your .obj file into an .ase file. Also note that Belgabor's Modified Importer is a beta test version.



Step 1 : Pen, paper and imagination

For realism, try to find a picture of the object you want to create. Or you can start from scratch and design your own model. Decide on its proportions, keeping in mind that an adult peep in RCT3 is almost 2 metres high. Break down your object into simple parts/volumes such as cubes, spheres, cylinders, etc.

Tip Your object will become a file containing all the information needed by RCT3 to show your CSO in the 3D environment of the game. The larger the size of the file, the more demanding for the game (and ultimately for your computer) to handle it. Basically, the size of a CSO file is determined by two factors : its poly count (i.e. the complexity of its shape) and the size of its textures. A powerful computer with a powerful video card will be able to handle big files without experiencing much lag. Nothing prevents you from creating CSOs according to your computer performance but if you want to share them with other gamers, it is better to stick to a standard so that a majority of us can use them on our own computers. At this stage, you can only partially deal with the poly count of your object. The rule is : a very complex shape should be replaced by a 2D (flat) image representing it.

Try to find the texture(s) you would like to assign to your object or its parts. You will have to modify them later on before mapping them to your object.

Step By Step Let us create a lamp post. Here is a picture I found on the net that will serve as a model.

It will be around 4 metres high. My object will be made of a post, a lamp, some dragon-shaped ornament and a top. The post can be reduced to a cylinder and the lamp and the top to cubes. But notice that the ornament is much more complex and would require a lot of details to design. We could simply get rid of it but then our lamp post would look too plain. So following the rule above, we’ll use a 2D image and a few tricks (in particular, transparency) to represent it without increasing the poly count dramatically. So our lamp post can be divided into four basic parts.



Step 2 : Prepare Blender’s 3D environment [Blender]

When you start Blender, the programme automatically places a Cube, a Lamp and a Camera in the 3D environment. Since we don’t need the last two and may want to start with a different object, delete them. Click on View > View Properties and make sure that Grid Floor, X Axis, Y Axis and Z Axis are selected and that the value for Spacing is 1.00.


Tip See Orientation, Origin and Proportions.




Step 3 : Model your object mesh by mesh [Blender]

As I said before, I am not going to teach you how to model 3D objects in Blender. Here is a good start for beginners. Remember that you only need to know the functions related to Editing and UV Mapping to start modelling your own CSOs.

Note A few key notions. Basically, we want to create a MESH (i.e. the frame or skeleton that delineates the space/volume our object will take). To do so, we need to place VERTICES (i.e. dots/points) in our 3D environment. Each vertex has a set of three coordinates (represented as (X,Y,Z)) which define their positions. If we connect two vertices, they form an EDGE and if we have three connected vertices and if we fill in this triangle, we’ve created a FACE. QUADS (i.e. squares) are also useful and can be used with the latest versions of the importer but remember never to create more complex faces (i.e. faces with more than 4 vertices). Fortunately, we won’t have to create all our meshes by placing every single vertices defining them. Indeed, Blender provides us with ready-made basic meshes such as Plane, Cube, Circle, Sphere, Cylinder, etc. Also note that an OBJECT – in Blender – is a mesh plus its properties (colours, textures, etc.).

Create the mesh of your CSO in Edit Mode and make triangle or quad faces (F-KEY). No faces should have more than four vertices.

Tip "The N-KEY allows you to enter vertex/object coordinates directly almost everywhere. For example it allows for very precise UV mapping [see Step 5]." (I quote Belgabore)

Tip While creating your CSO, always remember to keep the poly count as low as possible (also see above). Try to find the right balance between details and simplicity. Vodhin suggests that “everyone should keep in mind about scale: a large column that fills an entire RCT3 grid square might need about 10 or 12 sides to look smooth, even with welded [see step 6 below] vertices. However, say you want a thin rod to hang a banner from, then you really only need 3 sides and be sure to weld the vertices. Another trick: making a multi-mesh object: you can delete those faces that will not ever show (may not be good for some round, welded objects)”. The number of faces in your object should not exceed 500 and the rule is : the more you want to use your object in your park, the smaller the number of its faces should be.

In the Editing window, under Link and Materials, following “OB:”, type in an adequate name for your object (e.g. wall, door, lamppost, etc.). This is the name that will appear in Jonwil’s importer in the Mesh List in the Create Scenery Window.

Tip If your object is complex, it is better to seperate its main parts (in Edit Mode, select the vertices you want to seperate, then click on Mesh > Vertices > Seperate) into distinct objetcs. Give each part/object an adequate name. Selection of individual parts becomes much easier and it makes it possible for you to apply a different texture to each distinct part of your CSO (note that Blender’s “objects” are referred to as “Meshes” in Jonwil’s Importer – a bit confusing!). Conversely, if you want to use one single texture for your entire CSO, placing all the bits of images you need on a unique texture (patchwork), simply check the option “Apply to All Meshes” in the Mesh Flags window of the importer.

Step By Step Here is the lamp post once it has been modelled. It is made up of four parts : the lamp and its top are basic cubes that I have manipulated (extrude, grab and scale) to give them the shape I wanted. The post is a cylinder with six sides. Considering Vodhin’s advice, it is a bit too detailed and five sides may have been sufficient to give it a nice round shape. I have also manipulated the cylinder to create the base. As you can see (or can’t see as a matter of fact), the dragon-shape ornament does not appear. Instead, there are four plane faces, two on each side and each one a little inclined for them not to be superimposed. I have also deleted faces that will never show in the game, e.g. the one under the post since it would be on the ground. Each part was modelled as a distinct object (which I named “Post”, “Lamp”, “Top” and “Dragons”).




Step 4 : Create your textures [The Gimp]

Notes First read
LuckyGirl’s post on copyright. She also provides good links to get textures. Here is a good start if you’re not familiar with The Gimp.

Create your texture keeping in mind that it has to be a perfect square (save it as an .xcf/Gimp file in case you want to manipulate it again later).

Tip To avoid increasing the number of texture files exponentially, you can put different bits of images on one single square texture (patchwork)

For adjacent faces (i.e. faces that have a common edge) sharing the same texture, try to make the latter seamless.

Tip A seamless texture is a texture that can be applied to adjacent faces without visible transition (seam) between one face and an other. To know whether an image is seamless or not, open it, click on Filters > Map Filters > Small Tiles and set the Number of Segments to 3. Click on OK to apply the filter. Undo to come back to your original image. Read tutorials on the net.
Change the size of your image so that it is 64x64, 128x128, 256x256 or 512x512 (i.e. a power of two).

Tip Applied to a 4-metre-high/4H wall in RCT3, the render quality of the above sizes is very low, low, good and excellent respectively.

All major image formats can now be used in the new importer (among which .bmp, .png, .jpg and .tga). However, if you don't have Belgabor's version of the importer, you have to convert your texture into an indexed bitmap image. Click on Image > Mode > Indexed colours and select a 256-colour palette (8bits).

Tip For recolourable CSOs, read the RCT3-RecolourableObjects.pdf file included in the folder containing Jonwil’s Object Importer and use the
following palette compatible with The Gimp
. Other palettes may come in handy : 256 shades of grey, 256 shades of magenta, 256 shades of yellow and 256 shades of blue. Copy-paste palettes in C:\Program Files\GIMP-2.0\share\gimp\2.0\palettes with the other .gpl files.

Tip For alpha textures, see this post and Vodhin’s Alpha Experiment. Save your alpha textures as greyscale .bmp files. Semi-transparency is still a great mystery to me because of unexpected results (e.g. X-ray effect, interaction between textures set as SIAlpha and others set as SIAlphaMask, etc.)

Save your image (do not RLE encode indexed .bmp files - see LuckyGirl's post).

Step By Step Here is my texture (patchwork method) and my alpha texture. Both textures are 256x256 .bmp images.
Note Here are the typical sizes of 8bit .bmp files: (64x64) = 5,05Ko, (128x128) = 17Ko, (256x256) = 65Ko, (512x512) = 257Ko.




Step 5 : UV mapping [Blender]

Note Have a look at
this tutorial on UV Mapping. Also check this video from blender3d.org.

The more complex your object, the longer UV mapping is. In the UV/Image Editor, apply your texture(s) to every face. Make sure you are in UV Face Select Mode and set the Draw Type to Textured to visualize your manipulations. Since faces are one-sided, switch to UV Face Select Mode to make sure that they are properly oriented (outwards, i.e. you should face the visible sides of each face). Here is an example of a face turned inwards. If they are not, in Edit Mode, either select all, click on Mesh > Normals > Recalculate Outside or select only the face(s) facing inwards, click on Mesh > Normals > Flip.

Note You may encounter problems when loading 8bit .bmp files for UV mapping in Blender. If so, simply use a copy of your image in a different format (e.g. 24bit png - see Belgabor's post).

Step By Step Once every face has been UV mapped, here is what we get in Textured Draw Type.




Step 6 : Z-axis, triangulation, welding and centring [Blender]

These are the last steps to make your object(s) compatible with the ASE format.

Z-axis
(If you have Belgabor's Modified Importer, skip this section)

If your object and/or your texture(s) are not symmetrical, they will appear mirrored in the game, due to the inversion of Blender’s Z axis (see Proportions, Origins and Orientation). The following lines explain how to remedy this problem. However, if your object and your texture(s) are symmetrical, it is not necessary to apply the following modifications since you should not notice anything in the game.

Note If your CSO is made up of more than one (Blender) object, the Mirror transformation must be applied to each part individually in Edit Mode.

Place the cursor at (0,0,0), choose 3D Cursor as Pivot, select your object and in Edit Mode, select all vertices and click on Mesh > Mirror > Z Global. Your vertices are now mirrored but your faces are turned the wrong way. In UV Face Select Mode, select all faces, click on Mesh > Normals > Flip to turn all faces outwards. Your object is mirrored now.

Triangulation

There shouldn't remain faces with more than four vertices - see Step 3.

(If you have Belgabor's importer, skip this section)

In Edit Mode, select all vertices, click on Mesh > Faces > Make Quads to Triangles.

(Un)welding

If you don’t have the latest version of Jonwil’s Importer, select all the vertices in Edit Mode, then click on Mesh, Script > Unweld > Unbind points. If you have the latest version of Jonwil’s Importer, you can decide on which parts you want to unweld and which parts you want to keep welded.

Tip See
Belgabor’s post

for detailed information on (un)welding. The rule is (I quote) : “keep roundy corners welded, unweld pointy corners.”

Centring

Each object in Blender has its own pivot (i.e. its centre). Make sure the pivot of all your objects are well-positioned. In Object Mode, in the Editing window, click on Centre New. Place your object(s) in Blender’s 3D environment (X, Y and Z axes) according to the indications given in Step 2.

Tip Check the number of faces in your object (top right corner of the screen, following “Fa:”). It should not exceed 500, especially if you want to place dozens of them in your park (see Step 3 for pieces of advice on how to reduce the poly count of an object).

Step By Step I have unwelded only the parts of my object I wanted “pointy”, i.e. the dragon-shaped ornament, the top and the lamp. I have kept the post welded to give it a nice rounded look in RCT3. I centred all the pivots and positioned my lamp post so that it stands on the edge of a square tile in the game.

Note that I am not going to use the Path Edge - Size in Jonwil’s Importer because I want to be able to place my lamp post wherever I like (and not only on the edges of paths). So instead I am going to use the Full Tile - Size. My lamp post has 190 faces, which is not excessive but if I place hundereds of them in my park, chances are that my computer will experience some lag.




Step 7 : Export into .ase format [Blender]

In the 3D View window, select the meshes you want to export, then click on File > Export > ASCII Scene (.ase) v0.6.1. Choose a directory and a name for your .ase file and click on Export ASCII Scene. Check Face UV and check Selection Only if you've selected only part of the meshes in the 3D View window. Click on OK.

Note If you have already exported your object and want to export it again under the same .ase file name, you'll have to quit Blender first (supposedly to empty the temporary variables used by the script and avoid overlapping of data, i.e. a corrupted .ase file - technically, this is a bug). Save your work, quit Blender, re-start it, re-open your object and run the Python script.




Step 8 : Jonwil’s Object Importer

See
Klinn’s tutorial and DarkRidePerson’s tutorial on particle effects and transformational matrices.

If you have Belgabor's Modified Importer, don't forget to check "Fix Orientation" in the Create Scenery window (there's now a new version of Belgabor's Importer that has the "Fix Orientation" option checked as default).


Tip Effect Points. The x, y and z values in the matrix correspond to the position of the effect point you want to create. Contrary to what DRP says, I don’t think these values are “relative to the object you are attaching [your point effect] to”. I rather think that the x, y and z values are relative to the origin of the 3D environment in which you have modelled your CSO. If you have Belgabre's Modified Importer, have a look at this post. If you don't, simply decide on where you want to place your point effet and insert a vertex or place the centre of your object there. If you want the x, y and z values of a vertex, select it and in Edit Mode, click on Mesh > Transform Properties and select Global : x = Vertex x, y = Vertex y and z = Vertex z. If you want the x, y and z values of the centre of an object (don’t forget to Centre New), select your object and in Object Mode click on Object > Transform Properties : x = Locx, y = Locy and z = Locz. Insert the corresponding values in the matrix and give an adequate name to you effect point to make it work.

Step By Step Voilà ! Here are a few pictures of our lamp post in the park.

Peeps seem to love it, don’t they ?





A few references

Blender
www.blender.org
mediawiki.blender.org

The Gimp
www.gimp.org
en.wikipedia.org/wiki/Gimp

Jonwil's Object Importer
http://www.iceatcs.co.uk/RCT3/
TutorialForUsingJonwilsRCT3ImporterProgramV111.htm

Further information
www.ataricommunity.com/forums/forumdisplay.php?forumid=315
http://belgabor.vodhin.net/index.html (a must-read)
http://sebar.com/wiki/index.php/Main_Page#RCT3_Resources



Proportions, Origins and Orientation

Proportions

A square tile on RCT3's (bright blue) grid is supposed to be 4 metres square. This is not exactly the impression you get in the game but this might be due to the “thickness” of the peeps. Correspondingly, a square in Blender is 1m². So one square in RCT3 is made up of 16 squares in Blender. If you zoom in in Blender, new subdivisions appear : each ‘subsquare’ is in turn 10 cm². A terrain increment is 1m high.

A path (on the ground) is about 3.4m broad. The upper end of a path slope is 1m high, that of path steps is 2m high.

1H, 2H, full and 4H walls are 1m, 2m, 3m and 4m high respectively. A wall is 20cm thick.

The platform of a coaster is 1m high. The upper end of the gentle upward slope of a coaster is 2m higher than its base, that of a steep upward slope is 8 metres higher. The dimensions of curved parts are illustrated below.




There are three different heights for peeps. A kid, a teenager and an adult peep are about 1m, 1.5m and 2m tall (the park inspector is the tallest peep).

Also read Belgabor’s post for more information.



Orientation and Origins

This is the main “technical” problem you encounter when importing CSOs from Blender to RCT3. Indeed, Blender and RCT3 use slightly different 3D environments.

In terms of orientation, Blender and RCT3 differ a lot. First because in Blender, height, i.e. up-down, is indicated by the Z axis (so that the X axis and the Y axis define the floor) whereas in RCT3, it is the Y axis that indicates height, the floor being defined by the X axis and the Z axis. If you have Belgabor's Modified Importer, skip the following paragraph since you simply need to check "Fix Orientation" in the Create Scenery window.

The easiest way to deal with this problem is to create your object keeping in mind that the Y axis in Blender indicates height, not the Z axis. In this case, Blender's Top View becomes the Front view and vice versa. The second major difference between Blender and RCT3 concerns the orientation of the Z axis : it is reversed. In other words, your object looks mirrored in the game. Note that this is a problem only if your object and/or your texture(s) are not symmetrical. In this case, you need to mirror your object in a particular way. (see Step 6 in Creating CSOs with Blender - a tutorial for further information).

Origins (coordinates (0,0,0)) are easy to handle, but this is true only if you choose “Full Tile” in the Edit Scenery Settings window of Jonwil’s importer. The eight other positioning options available can make things even more difficult. The following illustrations represent the possible positions of an object created at (0,0,0) in Blender once it is imported and placed on one of RCT3’s square tiles, according to the option selected in Jonwil’s Importer. Bright blue lines represent RCT’s grid, gey lines Blender’s grid, purple circles the positions available on one RCT3’s square tile and the X axis and Y axis Bleder’s axes. I’ve drawn black arrows to indicate that you can use RCT3's "Rotate" button. Note : The following illustrations are wrong in the sense that with Belgabor's new importer "the y-axis has to point away from the center" (I quote Belgabor).



Full Tile


Wall

1/4 Tile


1/2 Tile


Corner
I can't see any difference bewteen Corner and Wall (to be tested further)

Path Edge (Inner)*


Path Edge (Outer)


Path Centre*
same as Full Tile but rotation not available

Path Edge (Join)


Options followed by * made the game crash when I tested them.

Model, texture and import a 3H wall into RCT3

NEW! Tutorial video http://www.youtube.com/watch?v=zpvYV0oNM5c (poor video and sound/voice quality - I will replace the virtual voice by a more natural one - i.e. mine - soon)

First have a look at my first post (Creating Custom Scenery Objects with Blender). This tutorial requires Belgabor's Modified Importer.

Step 1 A wall can be reduced to a modified cube.
Here is the texture I want to use
. Right click on the image, then "Save Image As". Save it as "My3HWallTexture" (keep the .jpg extension).

Step 2 In Blender, in Object Mode,

select the lamp and the camera (Shift + Right-click) and delete them (Delete-KEY > "Erase selected object(s)"). Click on "View" > "View Properties..." and select "Grid Floor", "X Axis", "Y Axis" and "Z Axis". Make sure the value for "Spacing" is 1.00. Close the View Properties window.

Step 3 To give the initial cube a wall-like shape, in Object Mode, select it, press N-KEY or click on "Object" > "Transform Properties" to open the Transform Properties window and enter the following values : "SizeX: 0.100", "SizeY: 2.000" and "SizeZ: 1.500 (i.e. a 3H wall)".In the Editing window, in the "Link and Materials" section, next to "OB:", type in "My3HWall".Save as "My3HWall.blend".

Step 4 In The Gimp, open "My3HWallTexture.jpg". Check whether the image is seamless: click on "Filters" > "Map" > "Small Tiles" ; set the "Number of Segments" to 3 ; click on OK to visualise ; the image is seamless ; Ctrl + Z-KEY to undo and come back to the original image. Click on "Image" > "Scale Image", break the chain icon next to "Height" and "Width" and set both values to 256. Click on "Scale".

>>> [the following steps are optional if you have the latest version of Belgabor's Importer]

Click on "Image" > "Mode" > "Indexed...". Select "Generate Optimum Palette" and set "Maximum Number of Colors" to 256. Click on OK.

[end of optional steps] <<<

Click on "File" > "Save As". Type in a new name for your texture: "My3HWallTexture256".

>>>> [the following steps are optional if you have the latest version of Belgabor's Importer]

In "Select File Type", select "Windows BMP Image - bmp" (Belgabor's new version of the importer supports .jpg, .gif, etc image formats so you do not need to save your texture as a .bmp image).

[end of optional steps] <<<
Step 5 In Blender, open "My3HWall.blend". Split the 3D View window vertically into two windows (right-click on the bottom edge of 3D View window > "Split Area").Open the UV/Image Editor in the right hand side window (click on Window Type > UV/Image Editor). In the 3D View window (left), select the wall. Select UV Face Select mode and set Draw Type to Textured. In the UV/Image Editor window (right), click on "Image" > "Open..." and select "My3HWallTexture256.bmp". Click on "Open Image".In the 3D View window, select one face (e.g. one of the two front faces). In the UV/Image Editor window, grab, scale and rotate the UV face until it looks fine in the 3D View window. Do the same for all faces. If some faces are turned inwards, in the 3D View window, switch to "Edit Mode", select all (A-KEY), click on "Mesh" > "Normals" > "Recalculate Outside".Save your work.

Step 6 In Edit mode, select all vertices (A-KEY) and click on "Mesh" > "Scripts" > "Unweld" > "Unbind Points". In Object Mode, press N-KEY to open the Transform Properties window. Set "LocX:" to -0.100, "LocY:" to 0.000 and "LocZ:" to 1.500.

Step 7 Click on "File" > "Export" > "ASCII Scene (.ase) v0.6.1". Type in a name for your .ase file: "My3HWall.ase" and click on "Export ASCII Scene". Only keep "Face UV" selected. Click on OK. You now have an .ase file. Save your work.

Step 8 See Klinn's tutorial. In the Edit Scenery Settings window, check "Fix Orientation" and set "Size" to "Wall".