This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Filter Specs
A filter spec is a plain object: the filter's type, an ID, the filter's own parameters (listed on the filter pages) and the common fields below.
{
filterType: "field", filterId: "shield", // required
shieldType: 2, color: 0xcc00cc, // filter parameters
gridPadding: 2, zOrder: 2000, // common fields
animated: {time: {animType: "move", speed: 0.0015}}
}
Common fields
| Field | Default | Meaning |
|---|---|---|
filterType |
required | One of the 45 filter types. |
filterId |
required | Names this filter on the document: 1–64 letters, digits, _ or -. One ID is one filter; use several IDs to stack filters. |
enabled |
true |
false hides the filter but keeps it saved. |
zOrder |
per filter | Order in the stack; lower runs first. See zOrder. |
padding |
per filter | Margin around the object in scene pixels. See padding. |
gridPadding |
0 |
Margin in grid units, replacing padding. See gridPadding. |
sticky |
false |
Turn the effect with the object. See sticky. |
animated |
none | Parameter animations. See Animation. |
onComplete |
"hold" |
Keep the endpoint, or use "delete" to remove the filter after all active finite animations finish. See one-shots. |
Values
- Numbers must be finite (no
NaNorInfinity), between −1,000,000 and 1,000,000. Some have tighter limits:padding,gridPadding,thickness,distanceand blur values 0–256; glowdistance1–64;quality0.01–1 for glow and outline and 1–16 (blur passes) elsewhere;resolution0.1–4; electricintensityan integer 1–20. - Colors are numbers from
0x000000to0xffffff. Write them in hex:0xff8800. - Booleans must be
trueorfalse, not0or1. - Images (
imagePath,maskPath) are Foundry paths (icons/svg/fire.svg,worlds/myworld/fx.webp), URLs or#virtualtexture names. Query strings are kept.data:,blob:andjavascript:URLs and videos are rejected. - Arrays:
stops(colorGradient) is 2–32{offset, color, alpha}objects;kernelsis 1–16 numbers from 0 to 100;tint(ddTint) is three channels from 0 to 1.
Invalid specs are rejected before anything is saved, with a message that names the problem.
Construction options
Some parameters are compiled into the shader or load a resource when the filter is built: imagePath, maskPath, quality, kernels, stops, maxColors, tint, glow distance, electric intensity and distortion anchorSet. Changing one rebuilds the filter, and they cannot be animated. The filter pages mark them.
padding
Filters draw into an area around the object. padding is the margin, in scene pixels, that the effect is laid out on: a force field with more padding is drawn larger. On top of that, every filter gets a render margin of up to 50 px, so glows and auras that spill past the image are not cut off at its edge.
If an effect still looks clipped, or should reach further, raise padding. Some filters bring their own default (glow 15, outline 5, bevel 10, blur 16, drop shadow 10, twist 20, distortion 15); the filter pages list it.
gridPadding
gridPadding sizes the area in grid units and replaces padding. The object is first rounded up to whole grid squares, then gridPadding - 1 squares are added on every side:
gridPadding |
Area around a 1×1 token |
|---|---|
1 |
1×1 (snapped to the grid) |
2 |
3×3 |
3 |
5×5 |
Useful for auras and fields that should reach a set number of squares. Fractions work too (1.5 adds half a square per side).
sticky
By default the effect area stays upright when the object rotates, and on rotated Tiles and Drawings it covers the rotated bounding box. With sticky: true the effect area turns with the object, so patterns and offsets stay attached to the art. distortion is sticky by default.
zOrder
Region placement is a separate rendering option for the whole stack, described in Region rendering. zOrder does not move a stack among scene objects.
Filters run in ascending zOrder; each one processes the result of the previous ones. The filter list shows the defaults: color changes come early, auras and fields late, transform (1000) and distortion (4000) last. Set zOrder to change the order, for example to apply mirror images before an aura so the aura surrounds all copies.
leanFX's filters always come after filters from Foundry or other modules on the same object. Those keep their order and are never changed.
What can be filtered
| Object | What leanFX filters |
|---|---|
| Token, Tile | The object's image (its mesh). |
| Drawing | Its text if it has text, otherwise its shape. |
| Region | An overlay following the Region's geometry, independent of editor Visibility. Its whole stack can draw below tiles, above tiles or above tokens, or on the default interface overlay. Hidden/viewed-level state still applies. See Region rendering. |
polymorph needs a textured object: a Token, Tile or text Drawing.
Large objects
Most filters only render the part of the object that is on screen. shadow, transform, sprite, spriteMask, polymorph, images, twist, bulgepinch and colorGradient render the whole object, and one of them makes every filter on that object do the same. On a large Tile or Region at high zoom, that would need a huge graphics buffer (up to 1 GB per pass) or more than the graphics card allows.
leanFX lowers the render resolution of such an object's filters just enough to stay within 8192 pixels per side (or your graphics card's limit, if lower). The effect then looks a little softer while the object is that large on screen. Smaller objects, and filters that only render the visible part, keep full resolution. A lower resolution you set on shadow still wins. inspect(target).resolutionCap shows the current limit.