shade_facets
Shades hard-edged pixel art forms from a direction map, assigning one flat tone per plane so facets read as cut rather than rounded.
Instructions
Shade a form built from flat planes, one tone per plane, from a map of directions.
Args:
rows: One string per row of the map, one character per pixel, as `draw_pixel_map`
takes. "." leaves a pixel alone.
legend: {symbol: facet direction}. A direction is an angle in degrees in the same
convention as `light_angle` (0 faces right, 90 up, 135 up and to the left),
the word "front" for a plane square to the viewer, or `[angle, z]` to tilt a
plane toward the viewer as well, which is how a chamfer is said.
ramp: Colours darkest first. Facet tones are entries of this and nothing else.
light_angle, light_z: The key light.
fill_strength: How much bounce comes back from roughly opposite, as a share of the
key. Without it every plane facing away from the key clamps to the same
ambient value and the whole shadow side comes out one flat colour.
ambient: The floor, so a plane facing away is dark rather than black.
x, y: Where the map's top-left corner lands.
`shade_region_by_light` reads a surface normal out of how far each pixel sits from the
silhouette's edge. That is right for anything round and wrong for everything hard: a
distance field cannot know where an edge is, so it rounds the form over, and a crate
comes out as a cushion. This takes the normals from the caller instead, because which
way a plane faces is a fact about the drawing that only the person drawing it knows.
Every pixel of one facet gets the same value. That flatness is the point: it is what
reads as cut rather than inflated, and it is the thing a gradient cannot imitate.
Returns the usual write counts plus `facet_steps`, the ramp step each symbol resolved
to, so a caller can see the value structure it just asked for. A pass whose facets all
land on the same step is refused rather than painting a flat fill.
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>",
"rows": "<rows>",
"legend": "<legend>",
"ramp": "<ramp>"
},
"name": "shade_facets"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Default: 0. | |
| y | No | Default: 0. | |
| ramp | Yes | ||
| rows | Yes | ||
| frame | No | Default: 1. | |
| layer | No | ||
| legend | Yes | ||
| ambient | No | Default: 0.16. | |
| light_z | No | Default: 0.5. | |
| filename | Yes | ||
| light_angle | No | Default: 135.0. | |
| fill_strength | No | Default: 0.35. |