Skip to content
Tutorials menu
Tutorialsfinishing

Finishing touches: effects, variants, recolours and collision

These steps run locally, so they're free and instant. They're saved on the asset as recipes, not painted into the frames once, and every normalise_frames applies them again. Regenerating a walk or moving the pivot keeps the outline, shadow and hit flash. Run them after the asset has been normalised at least once.

The three ways an effect can apply#

as Result Typical use
bake Changes every frame of the asset An outline and ground shadow on everything
variant Adds copies of animations named <animation>-<name> (walk-hit) Hit flash, selection highlight, silhouettes
asset (palette swap only) A new, separate asset A red goblin from the green one

Effects always apply in the same order, whatever order you add them: palette swap, outline, hit flash or silhouette, drop shadow. An outline never goes around the shadow.

In the web app, the asset's Finishing tab lists its effects and variants, each with an on/off switch and Preview (that one effect alone, on the frame in the viewer). An effect turned off stays on the record (off: true) but is left out when the frames are normalised, and they're re-normalised at once; a variant turned off loses its animations until it's on again. Setting an effect again through Claude turns it back on.

Recipe: the usual finishing set for a character#

Give <hero> a 1 px dark outline (<#1a1020>) and a ground shadow. Add a white hit flash for <walk and idle>, and a feet collision box. Re-normalise and show me the sheet.

  • outline: width in px, colour, and corners: true for rounder outlines. inner: true recolours the sprite's own edge instead of growing it, which helps when the canvas is tight. Outer outlines need spare canvas: QA reports pixels pushed past the edge.
  • drop_shadow: an ellipse on the baseline, as wide as the body (opacity defaults to 0.35). It needs a few rows below the baseline; if there's no room, it's raised. In pixel art it's a hard-edged checkerboard, not soft alpha. For UI and icons, use shape: "offset" with an offset like {x: 1, y: 1}. For an asset rendered from a 3D model, shape: "model" uses the shadow the model itself casts, rendered beside each direction (page 11).
  • hit_flash: adds walk-hit, idle-hit and so on. In the game, switch to walk-hit for a frame or two, keeping the frame index. Limit animations to keep the sheet small. Change colour (red for poison) and strength (1 is flat colour).
    • Only some frames: "flash only on walk frames 1 and 5" (frames: [1, 5], or { walk: [1, 5], attack: [3] } per animation) keeps just those frames, so the sheet holds only what the game flashes on. The export then adds <id>-variant-frames, saying which source frame each one is (0-based): { "walk-hit": { "from": "walk", "frames": [0, 4] } }. In the game, swap in walk-hit frame frames.indexOf(walkFrame) when the walk is on one of those frames. frames works for any variant (outline, silhouette).
  • collision_shape: see below.

To remove one: "remove the outline from hero" (remove: true).

Recipe: silhouettes and highlights#

Add a black silhouette variant to <hero> for drawing it behind walls, and a yellow outline variant called <selected> for when it's selected.

  • silhouette adds <animation>-silhouette, flat colour. It also suits locked items and "who's that?" reveals. Silhouettes don't get the drop shadow unless you pass shadow: true.
  • outline { as: "variant", name: "selected", colour: "#ffd23f" } adds walk-selected and so on.

Recipe: recolours (palette swaps)#

Make a red version of <goblin> called <goblin-red>: green skin → <red>, keep the shading.

  • palette_swap maps exact colours, from → to. Run palette_extract first to list the asset's colours, or let Claude read them off the sheet. tolerance lets nearby shades follow while keeping their offset, so the shading survives. hue, saturation and lightness shift everything at once.
  • as: "asset" (the default) makes a separate asset with the source's frames and the swap built in. Running the same swap again refreshes it from the source, for example after you change the original's walk.
  • as: "variant" adds walk-poisoned-style animations to the same sheet. as: "bake" recolours this asset in place.
  • For pixel art, use exact palette colours so the result stays on the palette.

Recipe: painted art to pixel art#

Pixelate <hero> with <2> px cells and <24> colours, and show me the sheet.

pixelate turns painted frames into pixel art, for nothing. Every pixelSize × pixelSize cell of a frame becomes one flat colour with a hard edge, then the colours snap to the style guide's palette. Without a palette, the asset gets one of its own, shared by all its frames.

  • pixelSize is the cell size in canvas pixels. By default it aims for about 64 cells across: 1 for canvases up to 95 px, 2 for 128, 4 for 256. At 1, the pixels stay and only the colours and edges flatten.
  • colours is the size of the asset's own palette (default 32). It's ignored when the style guide has a palette.
  • The canvas doesn't change, so pivots, baselines, attachment points and collision shapes all still hold. A 2 px cell on a 64 px canvas looks like a 32 px sprite drawn at double size.
  • It's a recipe too: normalising applies it, before effects, so regenerating or re-normalising keeps the look. Your painted raw/ frames aren't touched, and "take the pixelate off hero" (remove: true) brings them back.
  • The palette stays put. New frames snap to the colours the asset already has, so nothing flickers between animations. Pixelate again to take a new palette from all its frames.
  • Effects come out hard-edged too: give an outline a width of pixelSize, or it will be thinner than the cells.
  • Paid depth doesn't carry over. Depth is kept per frame, so pixelated frames count as new ones. normal_map { method: 'depth' } buys them again.

Small painted sprites suit it best, and a sprite with strong shapes survives better than a detailed one. Check the contact sheet: at large cells, a face can reduce to a few blocks.

Collision shapes#

Give <hero> a feet collision box. Give <barrel> a circle with a 1 px inset. Give <rock> a polygon of at most 6 points.

collision_shape measures the normalised frames (before effects, so the shadow doesn't count) over the chosen animations, by default the default animation, and all directions.

shape Use for
feet Characters in top-down and three-quarter games, which collide at their feet (the default there). feet: 0.25 is the share of the height.
box Side-view characters and most props
circle Round things, or forgiving enemy hitboxes
polygon Irregular props (maxPoints, default 8)
  • inset shrinks the shape for forgiving hitboxes.
  • set stores a shape you give by hand.

On export it becomes a fourth content item, <id>-collision, relative to the sprite's origin (the feet), and the preview page draws it over every animation. Read it in the game with ContentManager.get('hero-collision').

Per animation and direction#

Give <knight>'s <attack> its own box per direction, on frames <3 and 4> only.

An attack's reach, a crouch's lower box, or a long body that turns with the sprite: collision_shape { animation: 'attack' } gives that animation its own shape, kept beside the asset's.

  • perDirection: true measures each direction on its own. Flipped directions get their source's shape mirrored about the pivot.
  • frames: [3, 4] measures only those frames (1-based) and records that the shape applies only on them: an attack's active frames.
  • set with animation (and direction) stores a shape you give; remove with animation drops just that one.

The same <id>-collision item carries them under animations, beside the asset's own shape, which stays where games already read it:

{ "type": "rect", "x": -6, "y": -8, "width": 12, "height": 8,
  "animations": { "attack": { "directions": { "e": { "type": "rect", … }, "w": { … } }, "frames": [2, 3] } } }

frames there are 0-based, as the game counts them. Use an animation's direction shape if it has one, else its shape, else the asset's. The preview page and the web app's export preview draw whichever applies on each frame.

Normal maps#

A normal map says which way each pixel faces, so a game can light a sprite: a torch can move past a character and its edges catch the light. normal_map builds one for every frame, free by default.

Using Atelier, give hero normal maps and show me how it looks lit.

You get a sheet with the frame, its normals, and the frame under three lights. Then tune it by eye:

  • bevel is how far in from the outline the shape keeps rounding, in pixels. About a quarter of the sprite's width looks round; the default of 6 suits a 64 px character.
  • strength is how pronounced the slopes are.
  • detail is how much the frame's brightness adds surface detail. Lower it for art with strong painted light, or that light gets read as shape.
  • flipY points green down, for a DirectX-style lighting setup.

This suggests form, rather than measuring it: there's no 3D here, only the outline and the brightness, so everything looks like one rounded pillow. It's stored on the asset, like effects, so every normalise_frames rebuilds it. Effects aren't included, so an outline stays unlit.

Measured depth#

For about $0.001 a frame, Replicate's depth model measures the form instead. A chest gets a separate lid, front and side, a table's legs stand apart from its top, and a 64 px character gets a head and arms. It needs a Replicate key (SETUP).

Using Atelier, give hero normal maps from depth and show me how it looks lit.

  • It's paid for once. Atelier keeps the depth of each frame in depth/, so tuning strength or detail, normalising again and calling normal_map again are all free. Flipped directions cost nothing.
  • relief is how far the nearest point stands out, in pixels, by default half the sprite's longer side. bevel and detail still work, with smaller defaults.
  • A walk of 8 frames in 4 directions is 24 calls. That's about $0.03, but an account with under $5 of credit is limited to 6 calls a minute, so it takes about 5 minutes. animations pays for only the ones you name.
  • If a frame changes, normalise_frames says so, and that frame uses the free bevel until you call normal_map again, which pays only for what changed.

Normals from a 3D model#

An asset rendered from its own 3D model (page 11) can take the model's surface directions instead, free and exact: normal_map { method: 'model' }. Directions that weren't rendered from the model use the bevel.

export_asset then writes <id>-normals.png, in exactly the same cells as the colour sheet, with <id>-normals-sheet and <id>-normals-atlas content items. Each frame also names its normal map as the sprite's normals layer, so with @basementuniverse/sprite 1.5 or newer the game gets the current frame's normals with sprite.getImage('normals') and lights it itself (the sprite doesn't draw them).

Next: Review and export.

Found a mistake? Edit this page on GitHub.