HowTo/Build a simple animated scenery asset in Blender

From TrainzOnline
< HowTo(Difference between revisions)
Jump to: navigation, search
(Created page with "In Blender create a new object such as a sphere and create a simple non texture material and colour it red, blue or whatever colour suits you. Name the material red.m.onetex....")
 
Line 1: Line 1:
In Blender create a new object such as a sphere and create a simple non texture material and colour it red, blue or whatever colour suits you.  Name the material red.m.onetex. Set the sphere at ground level.  i.e. just touching the ground. Call it Beachball.
+
==Caveat==
 +
[http://www.blender.org Blender] is not currently supported by N3V as a modeling source for Trainz, however third-party tools exist for this purpose.
  
In my example I used a beachball created for another experiment.
 
  
Position the cursor at the centre using Shift S ->Cursor to center.
+
'''''(Warning - this page is under development.  Some sections are incomplete and all sections require validation)'''''
 +
 
 +
= Introduction =
 +
 
 +
This tutorial demonstrates how to animate a simple ball scenery asset to make it bounce one metre and rotate through 360 degrees.  The asset has no practical purpose in Trainz other than to demonstrate how animation can be used on scenery objects.
 +
 
 +
= Requirements =
 +
 
 +
To export from Trainz you need the following:
 +
 
 +
:*  Trainz (TS09 or later preferred)
 +
:*  [http://online.ts2009.com/mediaWiki/index.php5/Downloads TrainzMeshImporter.exe].  This is provided by N3V.
 +
:*  Blender V2.57 or later.
 +
:*  [https://bitbucket.org/uschi0815/blender-exporter-for-trainz/downloads/ The Blender Exporter].
 +
:*  Windows Vista or Windows 7 (32 or 64 bit).
 +
:*  Some experience in the use of Blender to create assets for Trainz.
 +
 
 +
= Process =
 +
 
 +
In Blender create a new sphere object and name it Beachball.
 +
Create a simple material called "beachball.m.onetex".
 +
Allocate a simple texture and uvmap the sphere to the texture.  In my example I used a red 16*16 pixel TGA file.
 +
 
 +
Position the beachball so it just touches the ground.
 +
 
 +
Position the cursor at the centre using ''Shift S ->Cursor to center'''''Bold text'''.
  
 
Add a lattice and name it b.r.main.  The name is important.  You can resize to whatever size suits you.
 
Add a lattice and name it b.r.main.  The name is important.  You can resize to whatever size suits you.

Revision as of 23:12, 11 July 2012

Contents

Caveat

Blender is not currently supported by N3V as a modeling source for Trainz, however third-party tools exist for this purpose.


(Warning - this page is under development. Some sections are incomplete and all sections require validation)

Introduction

This tutorial demonstrates how to animate a simple ball scenery asset to make it bounce one metre and rotate through 360 degrees. The asset has no practical purpose in Trainz other than to demonstrate how animation can be used on scenery objects.

Requirements

To export from Trainz you need the following:

  • Trainz (TS09 or later preferred)
  • TrainzMeshImporter.exe. This is provided by N3V.
  • Blender V2.57 or later.
  • The Blender Exporter.
  • Windows Vista or Windows 7 (32 or 64 bit).
  • Some experience in the use of Blender to create assets for Trainz.

Process

In Blender create a new sphere object and name it Beachball. Create a simple material called "beachball.m.onetex". Allocate a simple texture and uvmap the sphere to the texture. In my example I used a red 16*16 pixel TGA file.

Position the beachball so it just touches the ground.

Position the cursor at the centre using Shift S ->Cursor to centerBold text.

Add a lattice and name it b.r.main. The name is important. You can resize to whatever size suits you.

Select the sphere object and position the cursor at the centre of your cube using Shift S >Cursor to selected.

(Note: In this case the origin of the beachball will be at the centre of the beachball, but if it is not then you can position the origin by selecting the beachball, select Object from the menu bar, then Transform ->Origin to geometry. Sometimes it is useful to have the origin elsewhere but for this instance we need it at the centre of the beachball.)

Change to Wireframe View to ensure we can see inside the cube.

Add a lattice and call it b.r.beachball. The exporter prefers these names to be in lowercase. The centre of the lattice should be at the centre of the beachball.

Now we set up the parent-child relationships:

Select the beachball and then while holding down the ShiftKey select b.r.beachball. Press Ctrl P and then select the Object option. This makes the beachball mesh a child of b.r.beachball. This is important because when we animate b.r.beachball, the beachball mesh will animate as well.

Now select b.r.beachball and while holding down the ShiftKey select b.r.main. Press Ctrl P and then select the Object option. This makes the b.r.beachball lattice a child of b.r.main.

If you look at the Outliner window in Blender, it should look like this: (insert pic)

Now we are ready to animate the beachball. Our animation consists of the ball bouncing up and down and spinning at the same time.

Arrange the screen layout as you wish but make sure you include a Timeline window. This is my layout for this session.

In the Timeline window, change the End frame to 30 and set the current frame to 1. For Trainz the animation rate is 30 frames per second.

Go to the Render window (see picture) and set the playback rate to 30 fps. Note this is a different location to Blender 2.49 which is rather odd.

Go back to the 3D View.

Select the lattice b.r.beachball. Move the cursor to that lattice by pressing Shift S ->Cursor to selected.

Bring up the Properties menu by pressing N (the cursor has to be in the 3D View for this to work). In the Transform area of the Properties menu, the Z location of the selected object (b.r.beachball) should be 1.0. If it slightly out then just change it manually. Similarly in the 3D Cursor location in the Properties menu the Z location should also be 1.0.

We are now going to insert the animation keyframes and for this to work the mouse cursor must be in the 3D View window.

With b.r.beachball selected, press I to bring up the Insert Keyframe Window. Select LocRot (location, rotation). You may notice the transform location windows changing to a yellow colour and the name of the selected object changing to an orange colour. This means that an I frame exists for that object at this particular frame. Frame 1 in this case.

In the Timeline window, change the frame position from frame 1 to frame 15 by typing the number in the Current Frame position.

With b.r.beachball still selected, in the Properties -> Transform -> Location menu, change the Z location from 1.0 to 2.0. You can just click on the 1.0 value and type the change. Press the Enter key and you will see the lattice and the beachball mesh move upwards. Note you can also move the lattice by pressing G and then Z and dragging it upwards in the Z axis.

With b.r.beachball still selected, in the Properties -> Transform -> Rotation menu, change the Z rotation value from 0 to 180. You will not see any visible change but that's OK.

Back in the 3D Window press I and select LocRot. This inserts our second I frame at frame 15.

In the Timeline window, change the frame position from frame 15 to frame 30 by typing the number in the Current Frame position or by clicking on the Jump to Last Frame button ( >>| ).

In the Transform window change the b.r.beachball Z location back to 1.0 and the Z rotation to 360.

Back in the 3D Window press I and select LocRot.  This inserts our last I frame at frame 30.

To test the animation click on the arrow (Play) key in the Timeline window.  You might want to change to solid or texture view to see it better.  The ball should bounce every second and do a full rotation.

Save the Blender file.

To export, select File ->Export -> Trainz Mesh and Animation.  In the dialog box make sure the Export Animation Data checkbox is checked.  (see pic)
Personal tools