The 2D layer · interface
SpriteTextureOptions
Explained in Sprites and tilemaps.
interface SpriteTextureOptionsimport type { SpriteTextureOptions } from '@driftengine/ui2d';Properties
| Name | Type | Description |
|---|---|---|
colorSpacereadonlyoptional | 'linear' | 'srgb' | srgb is right for anything painted to be looked at, which is every sprite sheet — the
sampler decodes and the pass's own output transform re-encodes, so the blend happens in
linear light where it belongs. linear is for a sheet carrying data rather than colour: a
mask, a height, a flow field.MoreThe same name and the same two values |
filterreadonlyoptional | 'nearest' | 'linear' | nearest by default, and the default is the argument.MoreA sprite sheet is usually pixel art, where linear filtering is the thing that makes it look wrong; and a sheet that is not pixel art is normally drawn near its authored size, where the two filters differ by very little. So the default costs the smooth case almost nothing and saves the sharp case from a blur nobody asked for. |
mipmapreadonlyoptional | boolean | Whether to build a mip chain and sample it. false by default, which is the sheet above.MoreThe case it exists for is type baked into an atlas. The comment on Neither workaround available to a consumer is good: baking nearer the drawn size blurs the headings, because one atlas cannot serve an 8x range of sizes, and baking a second atlas for small text doubles the pages and the uploads and moves a sampling decision into the game where it has to be re-tuned whenever a size changes. Off by default because the chain is wrong for pixel art, which is what most sheets are: it is memory nothing samples, and at a distance it dissolves art whose whole point is the pixel. With Padding cells against bleed is the caller's problem, and it has to be: a lower level mixes texels the atlas packer put next to each other, so a sheet whose frames touch will show its neighbours. How much padding depends on how far the chain is allowed to go, which is a fact about the sheet rather than about the sampler. |