by Katja Socher <katja/at/linuxfocus.org>
About the author:
Katja is the German editor of LinuxFocus. She likes Tux,
computer graphics, film & photography and the sea. Her
homepage can be found here.
Content:
|
Going 3D with Blender: A toy train
Abstract:
In this second article in our series about modeling with
Blender we create a little toy train. We assume that you have
read the first article Going 3D with Blender: Very
first steps and built that little stage yourself as we are
now using it as our starting point.
_________________ _________________ _________________
|
Going 3D with Blender: A toy train
Look at the illustration picture above and imagine it
without the Tux penguin. We are now going to create a similar
toy train.
Open the default.blend file with our stage settings that we
created last time as the starting point for our toy train. (In
case you saved them with the sphere and the cube select them by
a right click while holding shift down and press x to delete
them.) We will begin with modeling the last wagon. I still
used Blender version 2.27 when writing this article.
Building the last wagon first
To build it we start with a cube (for the green part): In front
view press Space and then Add-->Mesh-->Cube. Then press
tab to leave edit mode. With the cube still selected press s
(in front view) and scale the cube down so that it has the
right height. For the length press s again and hold the middle
mouse button down while moving the mouse to the right. This way
you restrain the change in size to the side you are moving the
mouse. Finally for the width go to side view, press s and again
move the mouse to the right while holding the middle mouse
button down.
Sometimes you will find that Blender doesn't want to do what
you intended to do. So you also have the possibility to work
with numerical values. Just hit n to get to the menu and change
the x,y and z values accordingly.
To give it a green colour go to the material button and the
white button, click "add new" and change the colour to green
(to get exactly my colour: R=0, G=0.82 and B=0). You can either
move the sliders with the mouse or you can left click on the
letters and then type in the values.
Now we need wheels for our wagon. In front view press Space,
then Add-->Mesh-->Cylinder (leave the vertices at their
default value of 32) and tab to leave edit mode. Make the
cylinder a bit smaller and thinner as you did with the cube: in
side view first press s and scale the whole cylinder down then
press s again and hold the middle mouse button down while
moving the mouse to the right (or hit n to use the numerical
values) to make the cylinder thinner. Give it a red material
(go to the material button, then press the white button and
"Add new" and move RGB to 1, 0 and 0 respectively), then in top
and front view place it (press g and move the mouse) on one
side of the wagon. The first wheel is ready.
Copy it by pressing shift + d and move (press g) the second
wheel to its place. Repeat this until you have all four wheels
in place.
Fig.1 Wheels and green part of the last wagon
Now we still need to build the yellow load of the wagon. In
side view hit Space--> Add-->Mesh-->Cylinder, then tab
and in top view scale it down (press s) so that the width is as
big as the width of the green part. Now press s again and
restrain the scaling to the length again (move the mouse to the
right while holding the middle mouse button down or hit n to
use numerical values). The load should fit exactly on the
wagon. Now click g and in front view place the load on the
wagon if you haven't done it already and by going to the
material button, clicking "Add new" and changing the colour
sliders to R=1, G=1 and B=0 you change the colour of the load
to yellow. The first wagon is ready! Congratulations!
The dark blue wagon
Next is the dark blue wagon which is quite easy to build as
you probably already see. In front and top view just select the
green cube and the four red wheels by right clicks while
holding shift down (in case some other part is also selected
unselect it by another right click while still holding shift down)
and then duplicate it by pressing shift + d. In top view move
it to the left and place it besides the other wagon. In front
view change the height of the wagon by right clicking on the
cube, then clicking on s and moving the mouse upwards a bit
while holding the middle mouse button pressed. Now move the
whole cube a bit up and give it a dark blue colour by going to
the material button, click "add new" and move the RGB sliders
to blue (R=0, G=0, B=1).
It might be a good idea to name the materials according to
their colour. So left click in the field that starts with MA:
and replace the default Material.00x by typing blue. Do the
same for the red, yellow and green materials (e.g. select a
wheel and go to the material button, the red colour is shown
now, left click in the field that starts with MA: and replace
the default Material.00x by typing red and so on.)
Fig.2 Naming the blue material "blue"
By the way you can use + and - of the numpad to zoom in and
out of your views. If you want to change the section that is
visible after you have zoomed in for example you can move
within the view by pressing shift and the middle mouse button
while moving the mouse.
Depending on how big you have made the two wagons it can be
necessary to scale them down when you add more wagons as you
won't be able to see them on your rendered image otherwise.
Just select all objects that belong to the train either by
clicking b and marking (draw a rectangle around) the two
wagons (shift + right click on objects you just
unintentionally selected by this) or by holding shift down and
clicking on every little object individually, then press s and
change the size of all wagons. This way all wagons will get
the same change in size and will so fit nicely to each other.
The wheels of our wagons should also slightly touch our floor.
By scaling them down they have probably moved themselves up a
bit so press g and move everything down on the floor again.
You can always press F12 to make a render and see if the train
looks good.
The orange wagon with red and green cylinders
The third wagon is easy as well: Again select the green wagon
and its four wheels (click b and mark the objects (draw a
rectangle around them), make sure that only the objects you
wanted to select are really selected, otherwise unselect them
by shift + right click), duplicate it (shift + d) and move it
to the left of the dark blue wagon. Change the colour of the
wagon to orange (right click on the cube to select it, then go
to the material button, press "Add new" and change the colour
sliders to R=1, G=0.647, B=0, don't forget to name your
material "orange" then). Now in top view click with the
red-white cursor in the middle of the right part of the wagon,
then press Space-->Add-->Mesh-->Cylinder, then tab to
leave edit mode. Scale the cylinder down (press s) and then in front or
side view place (press g) the cylinder on top of the wagon and
scale the height up (press s again with holding the middle
mouse button down to constrain the scaling) and give it a red
colour (go to the material button and click the white button
and then red.
The cylinder should now be in the middle of the right part of
the wagon (you can see this e.g. in top and front view). Next
you only need to duplicate it (shift +d), place it (press g) in
the middle of the left part of the wagon and change the colour
to green (go to the material button and choose "green" from the
list of materials).
Now the third wagon is ready too!
The red and green wagon
For the forth one select all parts of the dark blue wagon,
duplicate them (shift +d) and move them to the left. Select the
dark blue cube (right click) and change the colour to green.
Now in front view duplicate it and place it on top of the
other. Change the colour to red. That's it already.
The orange wagon
The same for the next one: In top view select all parts of the
dark blue wagon (right click on the blue wagon, then click b
and mark the objects), duplicate them and move them to the
left. Now select the dark blue cube (right click) in front view
again and change its height and its colour (to orange). As the
cube will move a bit downwards by scaling it up, move it a bit
up. Here we go.
The light blue wagon
By now you should have some practice with moving, scaling,
rotating and changing colours. So for the last wagon we will
use a new technique.
As you can see it is different from the others as it is open on
top. To create it add a grid in top view (hit Space, then
Add--> Mesh--> Grid). You are asked for Xres and Yres,
choose 8 with both. Click tab twice and select the two outer
lines of all four sides (click on b and mark the two lines on
top, then click b again to mark the next two lines until you
have selected all the two outer lines of the grid).
Fig.3 The grid with the two outer lines of all four sides
selected
Now in front view extrude the selected points by pressing e
and moving the mouse upwards. By extruding you create
three-dimensional geometry out of flat, two-dimensional shapes
and it is a technique you will frequently use when you work in
3D.
The rest you should already know by now: Click tab to leave
edit mode. Give it the right size (press s and scale it to make
it fit to the other wagons) and a light blue colour (R=0
G=0.714, B=1), add the four wheels by copying them ( shift +d)
from another wagon and place them accordingly (press g).
Finally you hit Space and then Add-->Mesh-->UVsphere
(change both, the number of the segments and the rings back to
32) to add the sphere. Press tab, scale the sphere down (press
s), place the sphere inside the wagon (press g) and change the
colour to pink (go to the material button, then click the white
button and "Add new", then move the colour sliders to R=0.8,
G=0 and B=1). Now go to the edit button (the button that looks
like a square with yellow edges) and press "set smooth" (as you
already did with the sphere in our previous article). The
sphere will get a much smoother look (a smooth surface).
The connection between the wagons
Before modeling the locomotive let's first connect our
wagons: Again add a grid (I chose 8 for the values of Xres and
Yres again but you could also choose Xres=8 and Yres=2..) in
top view to our scene, extrude it a little bit in front or
side view by pressing e and moving the mouse, then press tab
to leave edit mode and now in top view again resize it (press
s). Its length should be from the center of one wagon to the
center of the other with a little space between the two wagons
and it shouldn't be larger than one-third of the width of the
wagons (see Fig.4 and 5). Give it a material (R=0, G=1, B=1).
Duplicate it (shift +d) and place it between all wagons (don't
forget the one between the last wagon we modeled and the
locomotive).
Fig.4 The grid for the connection between the wagons
Fig.5 A connection grid between a wagon
The locomotive
Now the locomotive shouldn't be too difficult either: Again
add a grid (Xres and Yres being 8 again) to our scene in top
view. Then extrude it (press e) in front view. Press tab twice
and select (click on b, then mark with the mouse) only the
right upper half of the locomotive (the four points on top and to
the right). Extrude (press e) this part upwards again. Now give
the whole object a yellow colour.
The four upper points should still be selected, extrude (press
e) them again (but only a little bit). The new upper points are
selected now. Still having them selected press s while holding
shift down and move the mouse away from the model to make this
part bigger (see Fig.6). Now we have the outline.
Fig.6 The outline of our locomotive
To give the roof of the locomotive the blue colour select the first
line of points below them as well (at the moment only the top
upper line is selected, to select the line below them as well
press b and mark the line as always before). Then go to the
edit buttons and press "new" under the box where the colour is
displayed. Next press the "Select" box. Before pressing
"Assign" go back to the material button again and click on the
blue material. (Note that if you wanted to change the colour to
one that doesn't already exist you first have to press "Add
New" before you change the colour sliders to your chosen
colour.)
Fig.7 The buttons to assign more than one colour to one
object
The rest is "old stuff" again: Scale the locomotive to a size
that it fits to the other wagons (press s), add the wheels
like for all the other wagons and place the locomotive to the
left of the other wagons. Then duplicate (shift +d) the red cylinder from the
wagon with the two cylinders, resize it (press s) and place it
in front of the locomotive. Duplicate and resize this again (it
should have half the length of the other), move it to its place
and you have successfully modeled your toy train!
Here is a screen shot of the three different views in Blender:
Fig.8 Our train in the three different views
Finally
Your toy train is ready now. But somehow if you render it
(press F12) no shadows are displayed (even though you have
pressed the Shadow button in the Display menu). Just select the
spot light and press the "Only Shadow" button in the lamp
button menu. Now give the spot light a higher energy level
(e.g. a value of 5.0) and render your image again. There should
be some shadows visible now.
Time to admire your work! :)
Here is our train:
Fig.9 Our train
If you move the camera a bit up in side view and then rotate
it so that it looks down on the train you get this:
Fig.9 Our train from above (click on the image to get it in
big)
To save it as a .jpg image enter the directory and file name in the field
with the default entry /render (left click, then type in the
name) and also press the Extensions button. With this button
pressed the picture is actually saved with the extension .jpg
(or whatever format you choose) while otherwise the extension
is not shown. Press the OSA button plus any of the numbers
below (for quality), press the shadows button to see the shadow
the train creates, change the End:250 field to End:1 (either
make a left click and move the mouse to the left until the
number has changed to 1 or hold shift down while left clicking
in the field and then type in the value), choose the values of
SizeX and SizeY depending on how big you want your image to be,
choose Jpeg or any other format, press the RGB button and when
you now hit the anim button your rendered image is finally
saved.
Don't forget to save your train as a .blend file as well (go to
the menu --> Save as --> type toytrain.blend (or however
you want to name it)-->Save file) so that we can reuse it
again next time!
Have fun and happy blending:)
References
Talkback form for this article
Every article has its own talkback page. On this page you can submit a comment or look at comments from other readers:
<--, back to the index of this issue
2003-07-21, generated by lfparser version 2.38