surface_emission
Lights an interior source onto surrounding pixel-art surfaces by moving nearby pixels up their existing color ramp with distance-based falloff, preserving shading instead of flattening tones.
Instructions
Light an interior source onto the surface around it, up that surface's own ramp.
`glow` builds a halo on a layer **below** the artwork, and its docstring says plainly
that "a body blocks the halo of a gem inside it". So a glowing core inside a silhouette
gets nothing at all: on this project's golem, `glow` contributed zero pixels to the
export, which was confirmed by counting the colours in the committed PNG (nine: eight
stone steps and one core colour), and the longest comment in the old generator defended
a layer with nothing on it. What light from an interior source actually does is warm the
surface it sits in, and that is this.
It is neither a halo nor a gradient. Each pixel within `radius` of the source is moved
**up the ramp it is already on**, by a number of steps that falls off with distance, so
the surface keeps its own form: a crack near the core stays darker than the stone around
it, and both brighten. Painting a colour per ring instead, which is what a hand-rolled
bloom does, flattens every tone inside the radius to one value and reads as a gradient
laid over the figure.
Args:
ramp: Colours darkest first, and **the ramp the surface is painted on**: this moves
pixels along it, so a pixel further than `tolerance` from every entry is left
alone rather than dragged onto a palette it was never on. The warmth therefore
comes from the ramp's upper end, which is where a hue-shifted ramp is warm
(`generate_ramp` with `light_hue`). To tint as well as brighten, hand it a ramp
built from the surface's midtone up into the source's colour and the lift walks
into that hue.
source_color: The colour of the thing emitting, for example a gem or a molten core.
Source pixels are never repainted; they are where the light comes from.
radius: How many rings of surface the light reaches, in pixels.
depth: How many ramp steps the ring touching the source is lifted. The outermost
ring is always lifted by at least 1, because a ring that moves nothing should
not be in the radius. Refused at or above the ramp's length.
falloff: "quadratic" keeps the lift concentrated near the source, which is how light
falls off and what reads as a source; "linear" spreads it evenly.
tolerance: How close a pixel must be to a ramp entry to be lifted, as a weighted RGB
distance.
source_tolerance: How close a pixel must be to `source_color` to count as the
source. Defaults to `tolerance`, and it wants to be **tight** for the reason
`contact_shadow` documents at `occluder_tolerance`: the source is a flat colour
you named, while `tolerance` has to stay loose enough for shaded art that
varies, and one number cannot be both. The result warns when `source_color`
cannot be told apart from a ramp entry, because then the surface is partly its
own source and the light spreads from the wrong pixels.
layer: The layer whose surface is lit, and the one written (default: top layer).
frame: Target frame, 1-based.
**Why this is not an argument to `glow`.** `glow` writes a new layer below the subject
and promises the subject's cel is untouched, so deleting one layer removes the effect;
this writes into the subject's cel, because light landing on a surface is part of that
surface. `glow` paints only where the art is not; this paints only where the art is.
`glow` refuses when it runs out of room outside the silhouette; this refuses when it
finds no surface on the ramp inside it. An argument that reversed all three would be two
tools sharing one name, and it would make `glow`'s central promise conditional on a flag.
Refuses rather than reporting a pass that did nothing: no pixel matching `source_color`
is an error, and so is a source with no surface on the declared ramp around it. The
refusal carries the counts that say which it was.
Reports `per_ring`, how many pixels were lifted at each distance, which is the number
that says the falloff happened, alongside `lifts`, the steps each ring was given.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filename": "<filename>",
"ramp": "<ramp>",
"source_color": "<source_color>"
},
"name": "surface_emission"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ramp | Yes | ||
| depth | No | Default: 3. | |
| frame | No | Default: 1. | |
| layer | No | ||
| radius | No | Default: 4. | |
| falloff | No | Default: "quadratic". | quadratic |
| filename | Yes | ||
| tolerance | No | Default: 24.0. | |
| source_color | Yes | ||
| source_tolerance | No |