There is a plethora of superb MMD trains and railway related models, but have you ever wanted to know the ins and outs of how to use them?
Locomotion – How to move MMD trains
In this article we will show you how to set up a rural railway station and the basics of how to move a MMD model train along a track.
The Japanese have been fascinated with trains ever since the Meiji era when trains were first introduced into Japan and ever since then, trains have become not only a part of the Japanese landscape but in its culture as well. So it is not surprising to see trains frequently featured in Japanese anime movies and TV series. Also, many types of Japanese trains as well as stations are available as models to MMD animators. In fact, the Japanese MMDC has a niche interest in all sorts of Japanese train and accessory models and many fine animations are made using these models.
This article will show you how easy it is to use these models in your own animations. Word of warning though, Japanese train enthusiasts take great pains in creating the train models and animating them. Often times they will include details that will be missed by the casual viewer. This trait is also true of animators creating train scenes for animes. No matter how short these clips might be, they are usually rich in detail and highly accurate in their portrayals of the real thing.
But for the sake of brevity, we will only show you how to set up a scene and move a train as that isn’t hard to do. You can always do your own research and add the fine details later. So first off all, how do you find Japanese train and station models for use in MMD?
Fortunately, this is really easy. Japanese modeler Ejima8 maintains a catalog of Japanese train models and stations. Much of the site is in English and the Japanese notes are easy enough to translate using Google Translate. Plus it not only gives links to the models but also to the pages where there is more information on the model and where relevant passwords can be found.
The catalog link is here: http://mmdrailway.web.fc2.com/index-en.html
Japan has many types and models of trains but we will look at one type. These are the KiHas. The term KiHa is derived from the JR designation for this type of train: “Ki” – diesel powered car / “Ha” – standard or regular class. KiHas feature in many Japanese animes especially those that are situated in rural areas and they make fine subjects to animate for the beginner as they are usually short trains. Most often they consist of a single unit; in our terms a single model. KiHas are DMUs (Diesel Multiple Units) and typically one of these is a powered carriage which has operator controls at either one or both ends and passenger accommodation in the middle. In days gone by, to serve really remote areas, they might even have been used to transport freight as well but this practice has long been discontinued.
In this article we will be using the following resources:
Skydome: animesky0 by Seasalt
Kamihorokanai Station by Japanese modeler Tenpoku2000
Rural Tram by Japanese modeler SeasideExp
IA Rocks [Unofficial] – http://fav.me/da2yvhj
Music – Lift Motif by Kevin MacLeod
The station is typical of small ones operational in rural Hokkaido, Japan. Please note that the set includes components to recreate several stations, so don’t load all of the models into MMD. Just load one of the station models plus the tracks.
To complete the scene, just add a skydome. Just find one that suits the scene. Since with this set the station model includes distant mountain scenery, choose a skydome that matches the faded distant look of the mountains. When assembled, your scene should look something like this:
When setting up this type of scene the model draw order is very important. Typically, for a scene like this draw the models in this order:
1. The skydome.
2. The station and surrounding background scenery.
3. The tracks (since in this set this loads separately).
4. The performing model (IA in our example).
5. The train (This loads last as it has windows/transparencies and you want to be able to properly see through these).
Also, usually the skydome used will be smaller than the scenery model. So scale it up until it is large enough to see the distant hills/mountains. I simply upscaled the skydome I used by a factor of 10. I used the Si value in the accessory panel to do this. Note that you can only upsize x-file accessory models using the accessory panel controls. PMX or PMD format skydomes need to be upsized using the PMDe or PMXe.
With train scenes, your MMD world typically gets a whole lot larger than when staging a typical dance and song scene!
Typically with outdoor scenes the ground is uneven and/or is not located on the default ground plane, so turn OFF display of the ground shadows as these won’t work properly. If you look at the shot of the scene, you can still see that IA does cast a shadow. This is because the station model is properly set up to allow for self-shadows. Note that not all scenery models are set up this way and you may have to modify their shadow casting specifications using the PMDe/PMXe.
Note also that IA is standing on the platform and it’s elevation is not on the default ground plane nor is she anywhere near MMD’s world origin (her default load position). This will make focusing on her when you work on her difficult because of the way the MMD camera is set up. To correct the default behavior of the MMD camera, simply make IA the focus of the camera and it will behave normally around her when she is the selected model.
The train we will be using is a vintage DMU of the type that used to be commonly seen in remote rural areas of Japan. Typically, due to the sparse populations these trains were run as a single unit. The model is by Japanese modeler SeasideExp and comes in a set with multiple choices of color schemes. The specific type of train is possibly fictitious but based on a common type of that period but you see similar types in a lot of animes which is why I chose this model. Plus it’s small which makes it easier for illustrative purposes. It should have a train operator, but for our purposes I will omit this feature as what we want to do is to focus on showing you how to move the train.
The next image shows where everything is. Notice where the train is relative to the station buildings, the station platform, IA and most importantly where the world origin is:
MMD’s world origin is the point where the world axis meets. This is point 0x, 0y, 0z. In the image above we are some distance behind the front of the normal display. Exactly where the camera is, is actually shown in the MMD display but is unimportant unless you want to be mathematically precise. What is important though is that the MMD camera by default is aimed at a point about 1 meter above the world origin. This affects how the camera behaves which is why it gets extremely difficult to aim the camera if you are any distance away from the world origin. To compensate for this, MMD’s camera controls does allow you to focus the model either on an active selected model or on a selected bone on the active selected model. To access these controls simply check on either the model or bone check boxes in the view control panel. With a bit of practice you can shift your view easily to anywhere within MMD’s 3D world and rotate the viewpoint around a selected model comfortably but, MMD’s center of operation is still calculated from the world origin and this factor affects everything.
MMD like many 3D applications is designed to operate around a single world origin. This is the center of the MMD world. Specifically, the world origin is at coordinates 0x, 0y, 0z. For most dance and song routines, this is fine as the performance usually does not to stray too far from MMD’s default world origin point, if at all.
However, this is not true when you’re trying to create a virtual world such as when you’re trying to set up a scene featuring a car or a train. To get around this, the animator has to make a choice. Do you move the vehicle or do you move the scenery?
Moving the scenery is not a new concept. It’s been done in theaters for centuries. If you think of the axis grid in MMD as a stage it’s easy to translate this concept. Since everything is focused in the stage or axis grid area, you simply have to make a choice between moving the stage or moving the performing characters which includes vehicles as far as MMD is concerned.
But you do have one problem. IA and the train are two separate entities which must be able to move both independently of each other as well as relative to each other. So say for example, let’s say the train is approaching the platform to pick up IA, but at the same time IA is pacing along the platform. How would you do something like that in an animation. Or to complicate matters even further, the train has an operator and possibly even other passengers. To make things worse, let’s add a car to the scene, at least in concept and have the car move across the road to stop at the train barrier. In this scene the car would be moving perpendicular to the direction the train is moving and IA herself could be moving in almost any direction. Factors like these will determine whether it would be easier to move the train and the other actors or to move the scenery. On top of this you have to factor in where the camera or more precisely, the MMD viewport, is aimed.
The final decision depends on what you are trying to do, however, for this tutorial we will keep things simple, but we did want to raise these points in order to illustrate how far you can actually go in using MMD to create a virtual world scene. What we will be doing is actually very simple:
We will have IA waiting at the platform for the train to arrive.
Now that we have the basic outline on what we want to do the rest is actually very easy to set up.
Since we know IA is on the platform and the train will be arriving there, and since we know how the MMD camera/view port behaves, the smart thing to do is to relocate the world origin. So how do we do that? Well we don’t. Instead we will move everything relative to the world origin. This is illustrated in the next image:
This is what we did to create our final set up:
1. Since the tracks and the station scenery model are separate models in this set up, we made the station model the parent object of the tracks using the OP function. This way, when we move the station model, the tracks moves together with the station model. If you don’t know how to use the OP (Outer Parent) function, please see this tutorial: http://fav.me/d7ih8r9
With most station models, the tracks are integral so this step won’t be necessary, but there are nowadays many scenery models with multiple parts so the same method is used to link the separate parts together so that they all move together.
2. The train is then situated on the tracks so that it’s wheels are properly sitting on top of the rails.
3. Finally IA is positioned on to the platform to where we precisely want her.
4. Floor physics and display ground shadows were both then turned OFF.
The next image shows the scene from another point of view, this shows that all the components and actors are exactly where they need to be in terms of elevation relative to each other.
Two important points to note though:
1. IA and the train both have a mother bone. These were left at their default locations which happens to be at the world origin. You do not locate models in 3D space using the mother bone. This is not commonly understood. The mother bones true function is to allow a model to have a custom set origin point which you want in certain situations. For picture making, it doesn’t really matter. But when you begin to build complex animated scenes, get into the habit of not using the mother bone unless you have a really good reason to do so.
2. You turn off the floor physics as with multiple elevation scenes like this one, the default ground setting is no longer applicable. So for example, if IA was to come off the platform on to the area in front of the station buildings, the elevation here is now below the default ground plane and her physic will go flaky with the default floor physics settings still on. MMD’s physics and default ground shadows are set to calculate for operations on the default ground plane. When you set up multiple elevation scenes, make sure you turn off both or you will run into undesirable results.
OK, so we’re a good length into this article now and still haven’t moved the train so what gives you might ask? Well the simple answer is that if you get your scene correctly set up the train becomes really easy to move. And easy to move is a good thing, right?
But there is a complication… the train model has more than one center bone. So what gives? In fact, it has 2 mother bones… why does it have to be so complicated? Well we will tell you briefly and the answer is to allow the train to be animated in a realistic fashion. Not all train models will be set up in the same way, this one happens to be better than many with its bone structure. For our purposes, we actually only have to use the “center” bone to move our train. But those bones are there to allow the train model to be animated so that it can replicate exactly ALL the motions that a train body is likely to go through in a realistic manner.
But why does it have 2 mother bones?
This is actually a very useful feature and the simplest way of explaining this is if the train is moving in a straight line between two points – and note that in this application, this totally contravenes what I mentioned earlier above in saying that the mother bone should not be used. So the train is moving between two points, A and B. You set the first mother bone to where you want the train to be at the end of the animated sequence (point A). This would be the master mother bone. Then you set the secondary mother bone to where you want the train to start from (point B). For the sake of argument say that the animated sequence is 1000 frames in length.
Now remember what I said about the mother bone’s true function is to custom set the model’s world origin. All of a model’s bones positions are calculated relative to it’s world origin including any subsequent mother bones the model may have.
So, here’s the trick, to move between A and B, simply reset the value of the second mother bone at frame 1000. When the second mother bone is set, it doesn’t return to the world origin, but to the model’s custom set origin as defined by the master mother bone. What this means is that this allows the model to smoothly move between points A and B during those 1000 frame and no other calculations are needed as MMD will interpolate all the requisite values. Get it?
So what if the train has to negotiate a curve? Heh, do the maths… actually no, this model has a center bone that allows the model to be rotated around its primary mother bone. Pretty neat, huh? It will even accommodate parabolic curves. Tracks in real life turn on parabolic curves and if you want to be particular, there’s even something called “super elevation”. This is a slight tilt of the rails to help a train stay on a curve and you’ll most often see this with fast express train negotiating a curve. MMD models like the example used here can replicate that type of movement relatively easily too as it has the bone structure to do exactly that. The diagram below of this tram model explains in a little more detail how a vehicle’s positioning bone system can be used to allow almost any type of vehicular motion to be animated. Note that as far as MMD is concerned, a vehicle can be any form of transportation. All these model types (cars, trains, planes, tanks, boats, etc.) uses very similar positioning bone systems.
But, we’re going to keep things really simple. We’re just going to move our train from some distance away from the station to the station platform and since this is a straight track that is running precisely along the z-axis this is really simple to do. All we need to do is to push the train model all the way back and then figure out how long it will take to get there and we can even duplicate how it will stop at the platform in an authentic manner. Trains don’t come to a sudden stop, they slow gradually to a halt. All of this is easy to do and you don’t even have to do the maths unless you really wanted to.
So let’s decide how long our animation is going to be…
Since I have a premade standing motion for IA from another project that’s 1300 frames long (about 45 seconds) for our example animation we’re just going to go with that. Now we know where the train is going to be at frame 1300; at the platform where IA is waiting for it. All we need to do is decide where it started 45 seconds before. You could do the maths to figure out exactly how fast the train is traveling, but it’s easier just to do it by eye. Simply, I pushed the train right back up the track using its center bone and registered it’s position at that point at frame 0.
At frame 1300, I just reset the z-axis value of the center bone to bring it to a halt right where IA is standing. Now when we play back the animation the train will travel in a straight line between frame 0 and frame 1300.
But like we said, trains don’t come to sudden stops, to fix this and allow the train to come to a graceful stop all we needed to do was to add an interpolation curve at it’s final position.
But then just to watch the train come to a halt is boring and this train can do more such as opening it’s doors. So what we did was we edited the frame display to make the train stop at frame 1000. Since doors don’t immediately open when trains come to a halt we waited 100 frames before opening the doors, then allowed 150 frames for them to fully open. So basically our animation is now done.
Of course you can do a lot more. We haven’t even rotated the wheels for a start, but it’s hardly noticeable and so we can get away with not animating these in this example.
As for audio, you can custom make background sounds. There are tons of audio resources on the Internet that allows you to create authentic train sounds and assemble these tracks using software like Audacity. It’s easier, however, to just use a music track so we will go with a simple piece of background music for our sound track. To this end we’re using a 44 second instrumental clip that we downloaded from YouTube’s audio library. This music is free and licensed for royalty free use and is the perfect length for our 43 second long video clip plus it sets a nice mood for our scene.
Finally, a simple camera motion was set up. It starts off to set up the overall location, zooms over to IA, then swings around to show the train arrive at the platform and finally zooms in to show the action as the doors open. It does a decent job of telling our story.
One can do a lot in 45 seconds, but sometimes simple is best and we adopted the same approach with the lighting and MMEs. We set up a late afternoon shadow typical for a scene in a northern latitude. MMEs was just Full.fx, used to augment the color and shadows as rendered by the MMD engine. Autoluminous 4 was used to light the KiHa’s front head light which would be on even during the day for safety reasons. Diffusion 7 was added to blend everything in and add a softer, more relaxed mood for the scene. So the final production, which can be viewed at the link below, harmoniously blends everything in to tell a simple story about IA waiting at a quiet rural country station for her train.
In the final analysis, it just takes a little careful planning in advance and you should be able to take essentially a collection of complex disparate parts and combine them easily together in a harmonious way to produce a watchable animated sequence as an end product.
Thanks for reading!
– SEE BELOW for MORE MMD TUTORIALS…