Atlas and export
A game reads the skeleton, its animations and an atlas: the images packed into few pages. A GIF or a video is drawn from the same project, for a page, a trailer or a review.
Pack the atlas
- Choose the Pack tab at the left of the bar. The pages of the atlas are drawn over the canvas, each image where it goes.
- On the right, set the Padding around each image and the Largest page; untick an image to leave it out. These settings are kept in the project.
- Write atlas writes the folder
atlasof the project: a PNG for each page and the atlas file that says where each image is. The command line does the same:pantin pack examples/logo.pantin.
Under them, more room is taken out of the atlas, and each choice is kept in the project:
- Trim the borders leaves out the transparent pixels around each image; the atlas says where they were, so that each image is given back whole.
- Turn images lays an image a quarter round when that takes less room.
- Pack tighter fits the images closer, by free rectangles, on the smallest pages: slower, for a large character.
- Scale packs every image at a share of its pixels: lighter pages, less sharp.
- One atlas for each skin writes, beside the atlas of all the images, the atlas of the images
of each skin (
atlas_wizard.atlas.json), for a game that loads one costume; Shown chooses the one the viewport draws.
The command line has them too: pantin pack examples/outfits.pantin --trim --rotate --tight.
The Bevy and the Godot runtimes read an atlas trimmed and turned as any other.
Normal maps for lighting
A game that lights its scenes in 2D needs, beside each image, a normal map: which way each pixel faces. Pantin makes them from the images, laid out exactly as the atlas, so that a colour and its normal are read at the same place.
- Choose the Light tab of the bar. The canvas shows the normal maps on the pages of the atlas: each image is a cushion whose edges lean out, and the dark lines of its drawing are grooves.
- On the right, Strength makes the slopes steeper (0 is flat) and Softness rounds the edges over more pixels. Both are kept in the project.
- Lit shows the atlas lit by a light that follows the pointer over the canvas, at the Height you set, with some Ambient light: what a game will show.
- Write normal maps writes the folder
normalsof the project, an atlas file and a PNG for each page, as the atlas format says. The command line does the same:pantin light examples/robot.pantin.
Export an animation
File › Export › Animation… opens a window before the file is chosen:
- What: the animation, and the format: PNG images (alpha kept), JPEG images (of the quality chosen, on an opaque background), an animated GIF, an MP4 video (no alpha) or a WebM video (alpha kept). The videos are written by ffmpeg, which must be installed; without it they are greyed, and say why.
- Picture: the size; the character fitted with a margin, at a scale, or as the canvas shows it; the background.
- Time: frames a second, the speed, the frames, how many times they follow each other; for a GIF its colours and dithering, for a video its quality.
Export… then asks where. The export is drawn by the processor, so the pixels are the same on every machine, each frame on a core of its own, and runs beside the window with a progress bar and Cancel.
pantin render examples/fish.pantin swim --out swim.gif --size 512x512 --fps 30
pantin render examples/fish.pantin swim --out swim.mp4 --background '#ffffff'
Build the bundle for a game
A game loads a character from one file: its skeleton and animations, its boxes, its atlas and the normal maps of its images.
- File › Export › Bundle for a game packs the images, makes their normal maps and writes
build/<name>.pantinpackin the folder of the project, on a thread of its own. - The command line checks the project first and writes nothing when it has a problem:
pantin build examples/robot.pantin, which ends with 1 for a CI to stop. - The Bevy runtime reads it:
Character::load_bundle. What it holds, byte by byte, is the bundle format.
A web page that plays the character
- File › Export › Web page… opens a window: tick the animations and the skins the page offers. The first of each is shown at first; with no animation ticked, the character follows its graph of states.
- Export… asks for a folder: it gets
index.htmland the bundle of the project beside it. The page holds the web runtime and the bundle: opened from the disk, it plays with no server and no network, a button for each animation and each skin. - The web runtime is built once by
tools/web_runtime.sh target/web; until it is, the entry is greyed and says so. The command line writes the same page:pantin web.
Send a project
A project is a folder, and its images may be elsewhere on the disk. File › Export › Project as
ZIP… writes one file with the folder and every image the project shows, those outside it brought into
its sources; nothing else, no atlas. File › Import › A project packed as ZIP… unpacks
one beside it, in a folder of its name, and opens it; a folder that is there already is never written
over. On the command line: pantin zip examples/robot.pantin and pantin unzip
robot.zip.
Problems
With nothing selected, the panel shows the project and every problem it has, the same list as
pantin check and the MCP's check: a key that names an image its piece does not
have, a loop whose ends differ, a box on a bone that is gone, a state whose animation is gone, an image
that cannot be read. Show it selects what a problem is about, and a problem with an obvious fix
offers it in one click, one undo: take the key away, make the end of the loop its start, delete the box or
the state.
Check in a CI
pantin check reads projects and atlas files, says what is wrong with each, and looks for
the images they name. It ends with 0 when all is well and 1 when a file has a problem, so a CI can stop
on a broken character.
pantin check characters/*.pantin