Polished graphics can make the difference between a professional game and one that looks amateurish. Drawing high-quality sprites by hand can be a chore, especially in 2.5-dimensional games, when an object can be viewed from different angles.
Fortunately, there is a trick to generating very professional sprites with relatively little effort: model the objects in 3D, and render the models to produce the sprites. POV-Ray is a free rendering (ray-tracing) program which can generate photorealistic images, but modeling complex objects in pure POV-Ray code is cumbersome. By combining POV-Ray's rendering with an easy-to-use model editor such as Meshwork, one can produce professional game graphics in very short order.
The model at right, a little penguin character, took about twenty minutes from start to finish. Shown (figure 1) is the Meshwork editor view; there is also a texture map on the torso, not visible here. Use the 3D Preview (command-E) feature of Meshwork to preview your model from various angles as it develops.
In my example, I produced a file called penguin.inc. I then used GraphicConverter to save my texture as penguin-tex0.png, matching the texture name in the include file.
Animation in POV-Ray works by running a "clock" built-in constant from 0 to 1, over some number of frames. You set the animation parameters in the Animation tab of the Render Settings dialog box. For eight frames, you'd set "Start At" to 1 and "End At" to 9 (one plus the number of frames), then "End At" 8, as shown at right. This will make the clock value increment in steps of 1/8 (0.125 at frame 1, 0.250 at frame 2, etc.).
Then, in your POV-Ray scene file, you just use the "clock" constant to calculate the proper rotation. My example scene file does it this way:
object { Penguin scale 0.01 rotate (360*clock)*y translate -0.4*x }Rotation in POV-Ray is given in degrees, and can happen around any axis. So "rotate (360*clock)*y" means "rotate around the Y axis, by 360 degrees times the clock value". When you start the rendering, POV-Ray will make eight images, with the rotation varying from 0 to 315 degrees.
Eight views, suitable for sprites |
Up-close promotional mug-shot |
Another perk of generating your sprites from a 3D model is that you can use the same model for other views -- like the promotional close-up shown on the right.
Alternatively, you could just set the background color in your scene file to something unlikely (by using the "background" command under Templates > Statements). Then, your blitter can recognize this as the transparent color.
I didn't use this technique in my example because I wanted to demonstrate shadows. To get 2.5D sprites which work transparently over a background but also have shadows is beyond the scope of this document, but if you're interested, let's talk about it!
I hope this essay helps you begin making your own 3D rendered sprites. If you have any difficulties, write to me or the Meshwork Discussion List.