Converting a 3D infantry model to sprites - UberWaffe/OpenRA GitHub Wiki

Here is the required software for this tutorial. Please note that you can use any palette aware image editor (like Photoshop) and 3D editor (like the Open Source Blender).

Open up 3DsMax.

blank scene

Create a 3D model (image shows a pikeman for a medieval mod). If you have no idea how to create a model, read a tutorial elsewhere.

pikeman

It's important to have body parts such as arms, legs and head as movable parts because they will be animated later. As you can see there is no need to create a very detailed model because they will be reduced to few pixels later anyway.

When coloring the model be sure to use

  • R: 196-150
  • G: 172-131
  • B: 98-74

as a team color (for Red Alert [Palettes and Remaps](Palettes and Remaps)). Also use a color that can be easily identified for the shadow.

Bones

Now use the Bones Tool on all relevant body parts. At least feet, upper legs, lower legs, torso (addition 2-3 bones make the model more flexible), head, upper arm, forearm and hands. Link the body parts to the bones, but don't forget accessories like hats. The weapon should consist of only one part which will be animated separately.

Now animate your character. Create a cuboid far below the figure and link it to the main bone of the figure. No you can create the different angles and have the shadow always on the correct side. Copy your animations and simply change the angle of the cuboid. Don't render the cuboid (check it's settings). It is suggested to hide everything except Bones and the cuboid.

Lightning

Use two spotlights. One should create a light shadow, the other none lighting up the figure from the other side (otherwise it might stay black). Use the sun-light option in 3DsMax.

Spotlight 1:

  • light direction: X=31.377; Y=0.0; Z=-24.935
  • light multiplicator: 0.301
  • light color: 255,255,255
  • shadow color: 99,99,99
  • shadow density: 0,0

Spotlight 1:

  • light direction: X=31.377; Y=0.0; Z=-174.868
  • light multiplicator: 0.611
  • light color: 255,255,255
  • shadow color: 0,0,0
  • shadow density: 0,76

Because sun light is simulated the spreading and length is not important.

Cameras

To get the object in the correct size adjust the camera distance. Only the angle is important (~63°). Use the photo finish camera with aim set to 0,0,0 and object center at z=0.

Sprite Renderer

50x39 is the standard infantry frame image size Westwood used in their early games. If you want to use OpenRA.Utility.exe for SHP conversion you need a single "film-strip" with all frames appended to each other, so select SpriteSheet: Image Width = Frame Width (50) * Number of Frames (124) = 6200 in this example and set Image Height to 39. You might want to experiment yourself with the settings, but be sure to turn off Anti-Aliasing otherwise the sprites will be blurred and useless.

gimp

Now open GIMP and load the image. Do some cleanup at first. Remove any help lines. To apply the RA palette go to Image-Mode-Indexed.

indexing

If you don't have it saved use OpenRA.Utility.exe (see above) to extract a SHP, convert it to PNG and extract the palette with GIMP. When applying the palette some things might go wrong. Often the team color is affected (fix it manually).

palette

To edit images in GIMP you need to go back to RGB mode. Be sure to only use the colors from the palette. Set the background to black and the shadow color to neon-green (top row in RA palette). If the shadow is gone after the palette has been indexed undo and manually colorize shadows neon-green before indexing. Index the image again with the RA palette and save it. You can now use OpenRA.Utility.exe --shp your.png 50 with 50 being the frame width.

helplines

If you want to use XCC Utilties (might get annoying) you need to do some cutting. Use the Pixel every x plugin in Gimp. Check if all frames are in it's boundaries with the feet centered.

Guilliotine

Now use the Guilliotine to Layers tool in Gimp. Remove the blank layers and use the Rename Layers tool. Press Export Layers to save every layer in a single PNG and use a mass renamer tool of your choice and rename it to filename000.png to filename213.png starting at zero and not using more digits than necessary. In XCC Utility right-click on filename000.png and select Convert to SHP. Be sure to have the correct palette set in the menu settings.

Now set up your sequences in OpenRA and see our Modding Guide on how to create a new unit.