Monday 7 January 2013

OpenTTD 32bpp Part 3 - Automation

3D software makes it quick and easy to make high quality textured and shaded sprites, but it is not just limited to still images; 3D software is normally designed for animation. Using the animation tools in Blender I could massively simplify producing sprites for OpenTTD.

The graphics for different trucks are a great example.


There are 3 different generations of truck graphics (old, current and futuristic), 16 different cargo types and loaded and unloaded graphics; that's 96 different combinations! Designing the graphics in 3D allows the truck to be broken into chunks; the truck body, the trailer and the cargo.


A screenshot of the 3D source for the truck graphics.

With this setup making the various combinations of truck body and cargo is simple; different animation frames just have different trucks and cargoes positioned in front of the camera. It does need a bit of geometry to get all the angles perfect though:
OpenTTD's sprites have the front left and front right sides at 26.56805 degrees from horizontal.

In 3D it is simpler, the camera is at an elevation of 30 degrees.


Each truck has 8 sprites for the 8 different directions it can drive in. Creating these 8 different images using the animation tools in 3D software is also easy, just rotate the truck 360 degrees in front of the camera over 8 frames.

Finally a few extra images are needed to complete the set of sprites required. One of these is the mask sprite to show which bits of the truck should be coloured using the company colour:


Other ones are the different sprite sizes for different zoom levels (256px, 128px and 64px).

Handily these types of outputs are also useful for animators. This tangle of image processing nodes in blender automatically generates and saves these different images:




This level of automation generates all the sprites OpenTTD needs with the minimum of effort. With a little bit of coding these sprites are now recognised by OpenTTD and can be used.

Continued here: OpenTTD 32bpp Part 4 - The Finished Product


Software used:
Blender: 3D modelling and rendering.
OpenTTD: The game!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.