A Dream of Electric Sheep - By Phil Baines
It is possible to make a simple animation of individual animals and using TS2014's AnimatedScenery blueprint, place them in game. I will be using this option, but, whilst I think it is very suitable for single or small groups of animals, such as horses, it seemed that a flock of sheep, or herd of cattle, needed a more random approach. A field full of cows all doing the same thing would probably look worse than the current static models.Looking at the options available, the current animated characters we see on platforms appeared to provide the nearest thing to random movement, so I decided to see if the technique would work for quadrupeds as well as bipeds?So, first catch your sheep!
As this was to be a Proof of Principle exercise, there were a lot of short cuts in order to speed the process up and this was the first shortcut, as it is a free mesh I downloaded from the web, thanks to azly. It is only for personal use so will be replaced when the final version is created, also, it had several thousand polys which I reduced to 2000, but that is still too high for this kind of model.
With the mesh in side view the bones are added to the model to prepare it for animation. I used a picture of a sheep skeleton I found on the web as a guide in placing the bones.
Putting the model into see through mode, bones were quickly added to each limb, the spine, neck and head. Again, for speed, no attempt has been made to make it very tidy. Also, as the animations would also be just trial ones, no IK chains were added, as the bone placements were to be added by hand.
Note, that whilst it is common practice to re-name bones, root/neck/hip etc, to assist the animation process, this is not possible in TS2014. They can be re-named but they must be prefixed by bone_. So, "bone_root" is possible but not just "root".
If you wish to learn about bone placement there are lots of guides on Youtube.
With the bones in place the model could be skinned. Skinning is a long and tedious process to get right so I didn't try too hard, given the temporary nature of this particular model. So, apologies in advance for some of the images that follow!
Looking at the blueprints for existing Platform Characters there are three different elements. Firstly an AnimProceduralSceneryBlueprint which puts the animated model into the game. then the PlatformCharactersBlueprint, which collects all the characters together and finally, the PlatformSectionBlueprint, which is the loft the characters are generated on.
So the first requirement was to create the AnimProceduralSceneryBlueprint. The existing Platform Characters appear to have three different animations, walk, wait and shuffle, and these seem to be hard coded so, having prepared my sheep model, I now needed three animations!
I decided to make the walk animation first and to help me do it I turned to the father of animation, Eadward Muybridge.
Edward James Muggeridge was born 1830 in England. At age twenty, he immigrated to America, first to New York, and then in 1855, to San Francisco, where he acquired an interest in photography. At this time, he changed his surname to Muybridge.
Under the pseudonym "Helios," he set out to record the scenery of the west with his mobile darkroom. He produced a wide array of panoramic landscape photographs, most famously of Yosemite Valley, and travelled to Alaska to photograph the Tlingit people.
As Muybridge's reputation as a photographer grew in the late 1800s, former California Governor Leland Stanford contacted him to help settle a bet. Speculation raged for years over whether all four hooves of a running horse left the ground. Stanford believed they did, but the motion was too fast for human eyes to detect. In 1872, Muybridge began experimenting with an array of 12 cameras photographing a galloping horse in a sequence of shots. His initial efforts seemed to prove that Stanford was right, but he didn’t have the process perfected.
Between 1878 and 1884, Muybridge perfected his method of horses in motion, proving that they do have all four hooves off the ground during their running stride.
Muybridge worked at the University of Pennsylvania between 1883 and 1886, producing thousands of photographs of humans and animals in motion. During the remaining years of his life, he published several books featuring his motion photographs and toured Europe and North America, presenting his photographic methods using a projection device he'd developed called the Zoopraxiscope.
Many examples of his work are available on the web in picture format and as animated gif. Unfortunately, he didn't do any sheep but there are animated gif of a walking pig and I thought its gait was sufficiently close to what I needed for the sheep walk. Just needed to get the pictures into my modelling software.
OK, here is the geek bit! Please note, most of these operations do not seem to like drag-and-drop, so if you want to give this a try, please avoid it.
Save the animated gif to desk top then open it in photoshop using File\Import\Video Frames to Layers, and you will see in your layer palette all the layers that make up the gif animation. Then use Files\Scripts\Export Layers to files, give them a suitable prefix, e.g. pig and you will have a full set of images to work with.
There are two options at this point. Create the same number of planes in your 3d modelling software as there are animation frames, then create a Multi\Sub_Object material with each frame as a new sub-object in your material then apply it to the planes. The planes should then be aligned with each other, behind the model, where they are hidden or exposed sequentially during the animation process.
A more elegant solution is to load the collection of layer images into After Effects and convert it into a movie. If you haven't got After Effects, it can be downloaded for a free trial.
Use File\Import\File and select the first file in your collection of images, tick the box in the lower right corner for sequence then Import. This should load all of your images into AE. From the toolbar select Composition\Add to render queue then click the Render button on the right. This will create an .avi file of your images. In your modelling software create a single plane then texture it using the .avi file as a material. This does two things, it add the images to the plane and creates an animation timeline with a key frame for each image. Align the plane with your model and you are ready to go.
If you want to see this operation at work have a look at Dave Saxon's Youtube video here which will demonstrate it better than I can explain it.
With the video in place the bones could be animated, frame by frame, with the following result.
I quickly made two further animations for the wait and shuffle cycles and added them to the blueprint. For the wait cycle the sheep just turns its head to one side, and for the shuffle ir bends to eat the grass.
Next the PlatformCharactersBlueprint. This blueprint lists all the characters that will appear on the platform and, as I only had one, was fairly simple to set up. Other factors of this blueprint decide the population density of the characters and when they will appear. If you are familiar with placing Platforms as scenery, these are the adjustable items that appear in the right-hand fly-out of the editor.
Finally, there is the PlatformSectionBlueprint. This basically combines a platform loft with the platform characters to give the finished product. As I wanted to place the finished item anywhere on the route, the obvious choice was to have an invisible platform, so the existing terrain would show through. This was easy to achieve as I regularly use invisible lofts for viaducts, so I already had the necessary assets. Other items, such as entry point spacing and waiting point offset, are specified in this blueprint. Haven't a clue how these work so just copied some values from an existing people platform.
Finally, ready to place in game and ......nothing!
Took me nearly a week to work out the problem. Apparently these procedural platforms don't like being near the edge of terrain tiles. Moved the platform away from the edge and, at last, a result.
The following video shows the Sheep Platform Loft in operation. I apologise once more for the lousy skinning and weird animation.
I hope you agree I have achieved the Proof of Principle I set out to get, now the hard work starts, creating a new model with proper skinning and believable animation, plus the development of a herd of cows as well!