BillboardMaterial
BillboardMaterial represents a material for billboard rendering.
Properties
Section titled “Properties”alphaTest
Section titled “alphaTest”Type: number | undefined
Description: Pixels with an RGBA alpha value below this threshold will not be rendered.
Default: undefined
Example:
{ billboard: { alphaTest: 0.5 }}anchor
Section titled “anchor”Type: "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined
Description: Sets which part of the billboard sits on its position, as MapLibre’s icon-anchor does. For example, "bottom" stands the billboard on its position like a map pin. The anchor is also the point rotation turns the billboard around.
Can also be set per feature from a feature evaluator.
Default: "center"
Example:
{ billboard: { anchor: "bottom" }}backfaceCulling
Section titled “backfaceCulling”Type: boolean | undefined
Description: Whether the billboard is hidden when seen from behind. When false, both sides of the billboard are drawn. When true, only its front is drawn.
Only a flat billboard (see billboardFacing) has a back the camera can see. Its front faces away from the globe, so turning this on hides the parts of a large billboard that wrap over the horizon. It has no effect on an upright billboard, which always lies in the screen plane facing the viewer.
Default: false
Example:
{ billboard: { billboardFacing: "flat", backfaceCulling: true }}clampToGround
Section titled “clampToGround”Type: boolean
Description: Specifies whether to clamp the billboard to the ground.
Default: Required
Example:
{ billboard: { clampToGround: true }}Type: Color
Description: Specifies the billboard color as a Color instance. It multiplies the image’s colors, unless tintImages is false. An SDF icon of the sprite is drawn in this color.
Default: Required
Example:
import { Color } from "@navaramap/three";
{ billboard: { color: new Color().setHex(0xffffff) }}declutter
Section titled “declutter”Type: boolean | undefined
Description: Participate in screen-space decluttering: when labels/sprites overlap on screen, lower-priority ones are hidden. Enabled by default. Set to false to draw every label unconditionally.
Default: true
Example:
{ billboard: { declutter: false }}declutterPadding
Section titled “declutterPadding”Type: number[] | undefined
Description: Extra space around the sprite’s collision box, in screen pixels whatever sizeInMeters is. One to four values, expanded like CSS padding: [all], [vertical, horizontal], [top, horizontal, bottom] or [top, right, bottom, left]. Only meaningful when declutter is enabled. MapLibre’s icon-padding.
Default: [2]
Example:
{ billboard: { declutterPadding: [4, 8] }}declutterPriority
Section titled “declutterPriority”Type: number | undefined
Description: Placement priority for decluttering. Higher wins. Only meaningful when declutter is enabled. Can be overridden per feature via FeatureEvaluator.evaluate().
Default: 0.0
Example:
{ billboard: { declutter: true, declutterPriority: 1 }}declutterRank
Section titled “declutterRank”Type: number | undefined
Description: Coarse placement order for decluttering, compared before declutterPriority: every sprite of a material with a higher rank is placed before any label or sprite with a lower one, whatever their priorities. A per-feature declutterPriority therefore only reorders labels and sprites of the same rank. Only meaningful when declutter is enabled.
Default: 0.0
Example:
{ billboard: { declutterRank: 1 }}depthTest
Section titled “depthTest”Type: boolean
Description: A variable that determines whether front-facing models occlude back-facing models.
Default: true
Example:
{ billboard: { depthTest: true }}effectIds
Section titled “effectIds”Type: string[] | undefined
Description: Specifies the IDs of selective effects to apply (e.g., “bloom”, “outline”). Used in conjunction with SelectiveBloomEffectDesc or SelectiveOutlineEffectDesc.
Default: undefined
Example:
{ billboard: { effectIds: ["bloom", "outline"] }}emissiveColor
Section titled “emissiveColor”Type: Color | undefined
Description: Specifies the emissive color as a Color instance.
Default: undefined
Example:
import { Color } from "@navaramap/three";
{ billboard: { emissiveColor: new Color().setHex(0xff0000) }}emissiveIntensity
Section titled “emissiveIntensity”Type: number | undefined
Description: Specifies the emissive intensity.
Default: undefined
Example:
{ billboard: { emissiveIntensity: 0.5 }}geometryTypes
Section titled “geometryTypes”Type: ("point" | "line" | "polygon")[] | undefined
Description: Source geometry categories this material consumes. Adding "line" emits one billboard per line string by default, at its first vertex, as MapLibre places a symbol-placement: "point" icon on a line. Set placement to repeat billboards along the line instead. Adding "polygon" emits one billboard per polygon, placed inside it at the point farthest from its edges (each part of a MultiPolygon gets its own), or along its rings with placement. Setting the array replaces the default, so include "point" when point geometry should keep rendering. This option applies when the layer’s geometry is built: set it at layer creation. layer.update() applies a new value only to tiles loaded afterwards, so already-loaded tiles keep their previous geometry until the layer is re-created.
Default: ["point"]
Example:
{ billboard: { geometryTypes: ["point", "line"] }}height
Section titled “height”Type: number
Description: Specifies the height of the billboard. The unit is meters.
Default: Required
Example:
{ billboard: { height: 100 // 100 meters }}Type: string | undefined
Description: Name of the icon in sprite to draw, in place of url. As in MapLibre, a name the sprite does not have draws nothing and logs a warning, and so does any icon on a material with no sprite. Billboards stay hidden until the sprite has loaded.
Can also be set per feature from a feature evaluator.
Default: undefined
Example:
{ billboard: { sprite: "https://example.com/sprites/maki", icon: "airport", sizeInMeters: false, sizeRelativeToImage: true, size: 1 // the icon's own size }}ignorePlacement
Section titled “ignorePlacement”Type: boolean | undefined
Description: Keeps this sprite’s box out of the collision check, so labels and sprites placed after it can overlap it. The sprite itself still hides when it collides with one placed before it, unless overlap allows it. Only meaningful when declutter is enabled. MapLibre’s icon-ignore-placement.
Default: false
Example:
{ billboard: { ignorePlacement: true }}offset
Section titled “offset”Type: Vec2 | undefined
Description: Moves the billboard away from its anchor point, in the unit of size: pixels when sizeInMeters is false, meters otherwise. A positive x moves it right and a positive y moves it down, as MapLibre’s icon-offset does. The offset lies in the billboard’s own plane, so it turns with rotation.
Can also be set per feature from a feature evaluator.
Default: { x: 0, y: 0 }
Example:
{ billboard: { offset: { x: 0, y: -8 } // 8 units up }}offsetDepth
Section titled “offsetDepth”Type: boolean | undefined
Description: Avoids overlap with the earth’s surface. Use this to prevent the billboard from clipping into the earth’s surface.
Default: undefined
Example:
{ billboard: { offsetDepth: true }}opacity
Section titled “opacity”Type: number | undefined
Description: Specifies the opacity of the billboard. Valid range is 0.0 (fully transparent) to 1.0 (fully opaque).
Default: 1.0
Example:
{ billboard: { transparent: true, opacity: 0.5 // 50% opacity }}outlineBlur
Section titled “outlineBlur”Type: number | undefined
Description: Width over which the halo of an SDF icon fades out, in screen pixels, as MapLibre’s icon-halo-blur. The fade shows only with transparent set to true: an opaque billboard, the default, cuts the halo where it fades below alphaTest. See outlineWidth.
Default: 0.0
Example:
{ billboard: { outlineWidth: 3, outlineBlur: 1 }}outlineColor
Section titled “outlineColor”Type: Color | undefined
Description: Color of the halo around an SDF icon, as MapLibre’s icon-halo-color. See outlineWidth.
Default: Black
Example:
import { Color } from "@navaramap/three";
{ billboard: { outlineColor: new Color().setHex(0xffffff), outlineWidth: 2 }}outlineOpacity
Section titled “outlineOpacity”Type: number | undefined
Description: Opacity of the halo around an SDF icon, from 0.0 to 1.0. The halo also fades with opacity.
Default: 1.0
Example:
{ billboard: { outlineWidth: 2, outlineOpacity: 0.5 }}outlineWidth
Section titled “outlineWidth”Type: number | undefined
Description: Width of a halo drawn around a sprite icon marked "sdf": true, outside its edge, in screen pixels, as MapLibre’s icon-halo-width. The width stays the same at any icon size. Other images draw no halo. The halo can reach only as far as the distance field in the sheet does (6 icon pixels in MapLibre’s sprites, times the icon’s scale): a wider or more blurred halo is cut off there. MapLibre instead fills the whole box of the icon.
All four outline* fields can also be set per feature from a feature evaluator. A field the evaluator leaves out keeps the feature’s current value. Once any feature has its own halo, changing a field on the material with layer.update() sets that field on every feature, replacing their own values for it.
Default: 0.0 (no halo, unless outlineBlur draws a soft edge)
Example:
import { Color } from "@navaramap/three";
{ billboard: { sprite: "https://example.com/sprites/maki", icon: "dot", color: new Color().setHex(0xe53935), outlineColor: new Color().setHex(0xffffff), outlineWidth: 2 }}overlap
Section titled “overlap”Type: "never" | "always" | "cooperative" | undefined
Description: Whether the sprite may be drawn over labels and sprites placed before it (higher declutterRank, then higher declutterPriority, places first). "never" hides it on any collision. "always" never hides it, and its box still keeps later "never" ones away unless ignorePlacement is set. "cooperative" hides it only when it collides with a "never" one. Only meaningful when declutter is enabled. MapLibre’s icon-overlap.
Default: "never"
Example:
{ billboard: { overlap: "always" }}placement
Section titled “placement”Type: "point" | "line" | "line-center" | undefined
Description: How billboards are placed on line and polygon geometry. Only takes effect when geometryTypes includes "line" or "polygon". Point geometry is always placed at the point itself.
"point": one billboard per line string, at its first vertex, and one billboard per polygon, inside it at the point farthest from its edges. On a vector-tile source, a line whose first vertex lies outside the tile (where the tile cut it) gets no billboard in that tile."line": billboards repeat along the line everyspacing, evenly spaced regardless of where the line’s vertices are. Polygon boundary rings, holes included, are followed the same way."line-center": a single billboard at the halfway point along each line string or polygon ring.
With "line" and "line-center", each billboard is a single image at its anchor, turned to the direction of the line where it sits (see rotateToLine). Unless billboardFacing or rotateWithCamera is set, it lies flat on the surface and is aligned with the map, so an arrow image points along the line.
This option applies when the layer’s geometry is built: set it at layer creation. layer.update() does not rebuild billboards that are already loaded, so remove the layer and add it again to change it.
Default: "point"
Example:
{ billboard: { url: "/icons/arrow.png", geometryTypes: ["line"], placement: "line", spacing: 120, // Screen pixels billboardFacing: "flat", rotateWithCamera: false, // Arrows lie on the surface and point along the line clampToGround: true }}sizeInMeters
Section titled “sizeInMeters”Type: boolean | undefined
Description: Whether the size is specified in meters. If false, the size is in pixels.
Default: true
Example:
{ billboard: { sizeInMeters: true }}sizeRelativeToImage
Section titled “sizeRelativeToImage”Type: boolean | undefined
Description: Whether size scales the image’s own pixel height instead of setting the billboard’s height, as MapLibre’s icon-size does. With true, a size of 1 draws the image at its natural size: in pixels when sizeInMeters is false, or one meter per image pixel otherwise. The width follows the image’s aspect ratio either way. offset is not scaled by the image and stays in pixels or meters.
The natural size of a sprite icon is its pixel size divided by the pixelRatio in the sprite’s index, so an icon from a @2x sheet draws at the same size as from the 1x sheet.
Default: false
Example:
{ billboard: { url: "https://example.com/pin.png", // a 32 x 40 px image sizeInMeters: false, sizeRelativeToImage: true, size: 1.5 // drawn 48 x 60 px }}billboardFacing
Section titled “billboardFacing”Type: "upright" | "flat" | undefined
Description: Whether the billboard lies in the screen plane or on the globe surface, as MapLibre’s icon-pitch-alignment ("upright" is "viewport", "flat" is "map"). An upright billboard is never foreshortened, however the camera is pitched. "flat" lays it on the globe surface around its anchor, following the globe’s curvature, so it reads as painted onto the surface and foreshortens with camera pitch.
Combine with rotateWithCamera for four behaviours:
billboardFacing | rotateWithCamera | Result |
|---|---|---|
"upright" | true | Screen-aligned billboard (the default for placement: "point") |
"upright" | false | In the screen plane, turned with the camera heading so the image’s x-axis points east |
"flat" | true | Painted on the surface, turned to keep facing the viewer |
"flat" | false | Painted on the surface, north-up, turning with the map (the default along a line) |
Can also be set per feature from a feature evaluator as facing.
Default: "upright", or "flat" when rotateWithCamera is false (MapLibre’s "auto")
Example:
{ billboard: { billboardFacing: "flat" }}rotateToLine
Section titled “rotateToLine”Type: boolean | undefined
Description: Whether a billboard placed along a line turns with the line. When true, the direction of the line at the billboard’s anchor, as a compass bearing, is added to rotation. Only used when placement is "line" or "line-center".
The added bearing reads as a direction on the map when the billboard is aligned with the map (rotateWithCamera false). Flat on the surface, as it is by default along a line, the top of the image then points along the line, and rotation turns it further from there. Upright, the billboard stays in the screen plane and is turned by the camera heading plus the line’s bearing. On a billboard that turns with the camera, the bearing only spins the image on screen.
This option applies when the layer’s geometry is built. layer.update() does not change it for billboards that are already loaded, so remove the layer and add it again to change it.
Default: true
Example:
{ billboard: { geometryTypes: ["line"], placement: "line", billboardFacing: "flat", rotateWithCamera: false, rotateToLine: true, rotation: 90 // Point to the right of the line's direction }}rotateWithCamera
Section titled “rotateWithCamera”Type: boolean | undefined
Description: Whether the billboard turns with the camera or with the map, as MapLibre’s icon-rotation-alignment (true is "viewport", false is "map"). When true, the image stays upright on screen: a screen-aligned billboard, or with billboardFacing set to "flat", a surface image turned to keep facing the viewer. When false, it is aligned with the map. With "upright", it stays in the screen plane at full size but turns with the camera heading so that its x-axis keeps pointing east, and it shows upside down when the camera faces south. With "flat", it lies on the surface north-up and turns with the map.
Can also be set per feature from a feature evaluator.
Default: true for placement: "point", false along a line (MapLibre’s "auto")
Example:
{ billboard: { billboardFacing: "upright", rotateWithCamera: false // On screen, turned with the camera heading }}rotation
Section titled “rotation”Type: number | undefined
Description: Rotates the billboard within its own plane around its anchor point, in degrees, clockwise as seen from the front. The rotation is applied on top of the orientation that billboardFacing and rotateWithCamera resolve to.
anchor decides where inside the billboard the pivot sits.
Can also be set per feature from a feature evaluator, so every billboard in a layer can point a different way.
Default: 0.0
Example:
{ billboard: { rotation: 45 }}Type: boolean | undefined
Description: Specifies whether to show the billboard.
Default: undefined
Example:
{ billboard: { show: true }}Type: number
Description: Specifies the size of the billboard. The unit is meters.
Default: Required
Example:
{ billboard: { size: 10 // 10 meters }}spacing
Section titled “spacing”Type: number | undefined
Description: The distance between repeated billboards when placement is "line", in screen pixels. The unit is the same on geojson and vector-tile sources.
The billboards shown on a line are decided again as the camera moves. Pulling the camera back thins them out, and moving closer fills in more billboards between them. Billboards never slide along the line: they only appear or disappear. The gap on screen stays between one and two times spacing, also in a tilted view, where the near and far parts of the view each get their own density.
A line always keeps the billboard at its halfway point, and a line shorter than spacing on screen gets only that one. Billboards stop filling in very close to the ground (street level) on a GeoJSON source, and when a vector tile is shown much deeper than its own zoom level (overscaled). There they sit farther apart than spacing.
As with MapLibre’s symbol-spacing, a billboard longer along the line than three quarters of spacing spreads its repeats to that length plus a quarter of spacing. The length is measured in the billboard’s own frame: with rotateToLine the top of the image points along the line, so its height is what counts, and rotation turns it from there. On a vector tile source, each tile places billboards only inside its own bounds. Each tile spaces its own billboards, so repeats end up at most about one tile apart (512 to 1024 screen pixels) however large spacing is.
This option applies when the layer’s geometry is built. layer.update() does not rebuild billboards that are already loaded, so remove the layer and add it again to change it.
Default: 250.0
Example:
{ billboard: { geometryTypes: ["line"], placement: "line", spacing: 120 }}sprite
Section titled “sprite”Type: string | { id: string; url: string }[] | undefined
Description: Icon sheets that icon names refer to, in the format of MapLibre’s sprite. A sheet is one PNG image that holds many icons, with a JSON index that gives the position of each icon. Its URL is written without the extension: Navara loads <url>.json and <url>.png, or <url>@2x.json and <url>@2x.png on a high-DPI screen, with no fallback to the 1x files.
A string is a single sheet, whose icons keep the names in its index. A list loads several sheets, and their icons are named <id>:<name>, except those of the sheet whose id is "default". If any sheet fails to load, no icon of the sprite is drawn. The sprite is loaded again the next time a new tile or layer uses it. Each sheet is loaded once, however many layers use it.
An icon marked "sdf": true in the index is a signed distance field, as MapLibre encodes it. Its shape is drawn in color, with sharp edges at any size, and the colors in the sheet are not used. MapLibre draws such an icon black by default (icon-color), but color defaults to white, so set it. outlineWidth draws a halo around it.
Default: undefined
Example:
{ billboard: { sprite: [ { id: "default", url: "https://example.com/sprites/base" }, { id: "maki", url: "https://example.com/sprites/maki" } ], icon: "maki:airport" }}standalone
Section titled “standalone”Type: boolean | undefined
Description: Whether the billboard may show while the layer’s label at the same anchor is hidden. Unless both are standalone, a layer’s label and billboard of the same feature and anchor are placed as a pair, tested together so they never block each other. With false, the billboard is hidden whenever its label loses its spot, so false on both means both show or neither does. With true on both, they are placed independently and block each other where they overlap. Only meaningful when declutter is enabled. MapLibre’s text-optional (inverted: text-optional: true means standalone: true on the billboard).
Default: true
Example:
{ billboard: { standalone: false }}tintImages
Section titled “tintImages”Type: boolean | undefined
Description: Whether color tints images that are not SDF icons. With false, they are drawn in their own colors and only SDF icons take color, as with MapLibre’s icon-color.
Default: true
Example:
import { Color } from "@navaramap/three";
{ billboard: { sprite: "https://example.com/sprites/maki", icon: "dot", color: new Color().setHex(0x000000), // SDF icons only tintImages: false }}translate
Section titled “translate”Type: Vec2 | undefined
Description: Moves the drawn billboard by a number of screen pixels, as MapLibre’s icon-translate does. A positive x moves it right and a positive y moves it down, in the frame translateAnchor sets. The shift is applied after the billboard is projected, so it stays the same number of pixels at any distance and does not turn with rotation. Decluttering reserves the space where the billboard is drawn.
Default: { x: 0, y: 0 }
Example:
{ billboard: { translate: { x: 0, y: -10 } // 10 px up }}translateAnchor
Section titled “translateAnchor”Type: "map" | "viewport" | undefined
Description: Sets the frame translate is measured in. With "map", the shift turns with the camera heading, so a positive x points east and a positive y points south. With "viewport", it follows the screen axes. Unlike MapLibre’s "map", the shift is not foreshortened when the camera is pitched.
Default: "map"
Example:
{ billboard: { translate: { x: 10, y: 0 }, translateAnchor: "viewport" // 10 px right on screen, whatever the heading }}transparent
Section titled “transparent”Type: boolean | undefined
Description: Specifies whether to consider the billboard’s transparency. Note that setting this to true may cause the billboard to not display correctly when effects are enabled.
Default: undefined
Example:
{ billboard: { transparent: false }}Type: string | undefined
Description: Specifies the URL of the object. Supports image files. This is the default image for every feature in the layer. Individual features can override it by returning image from FeatureEvaluator.evaluate(), and returning image: null reverts an overridden feature to this default. Ignored while icon is set.
Default: undefined
Example:
{ billboard: { url: "https://example.com/icons/marker.png" }}