npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bitruvius/raster

v0.3.1

Published

Bitruvius raster visualization: colormaps, hillshade and 3D terrain rendering on WebGL2

Readme

@bitruvius/raster

Turn a decoded elevation raster into something you can see.

A decoder hands you a Float32Array of scalar values with a width and a height. That is correct and completely unreadable. This package turns it into a colour ramp, shaded relief, or a 3D heightmap, with no opinion about where the numbers came from.

Why it is separate

Visualization has no reason to know whether the values arrived as LERC, as a GeoTIFF, or out of your own solver, so tying it to a decoder would mean writing the same colour ramp again for the next format. Everything here takes a plain Float32Array plus dimensions.

The transforms are pure functions with no canvas, no GL context and no DOM, so they run in a worker or in Node as readily as on a page. Only TerrainRenderer touches WebGL2.

Three paths

| Path | What it does | | --- | --- | | colormapRaster | Normalize against zMin/zMax and apply a ramp, giving RGBA bytes for a canvas, ImageData or texture upload. | | hillshadeRaster | Shaded relief by Horn's 3x3 slope with Lambert illumination, the construction GIS tools use, as RGBA grayscale. | | buildTerrainMesh and TerrainRenderer | A centered 3D heightmap with per-vertex colour and faceted screen-space-derivative shading. Viewer-agnostic: it draws through a ViewerAdapter and a FrameState, so it is not bound to any one map. |

buildGeoTerrainMesh is the georeferenced variant, for a raster that carries an extent rather than being a bare grid.

Use it

import { colormapRaster, hillshadeRaster, turbo } from '@bitruvius/raster';

// values: Float32Array of length width * height
const rgba = colormapRaster(values, { width, height, zMin, zMax, colormap: turbo });
const shade = hillshadeRaster(values, { width, height, azimuthDeg: 315, altitudeDeg: 45 });

canvas.getContext('2d')!.putImageData(new ImageData(rgba, width, height), 0, 0);

Pass a mask (one byte per pixel, 1 valid, 0 nodata) and masked pixels come back fully transparent, rather than as a misleading colour at the bottom of the ramp.

A ramp is just (t: number) => [r, g, b], so turbo and grayscale ship here and your own is a one-liner.

Trademarks

Esri and LERC are trademarks of Environmental Systems Research Institute, Inc. The Turbo colour ramp originates with Google LLC and is used under Apache-2.0. All other marks are the property of their respective owners.

These names are used solely to describe the data formats this software interoperates with. Bitruvius is not affiliated with, sponsored by, or endorsed by any of them, and no such relationship is implied.

License

Proprietary. The full terms ship as LICENSE inside this package, and are readable before installing at cdn.bitruvius.com/legal/sdk-license-v1.txt.

© Bitruvius, Inc.