JSPM

quick-normal-map

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q22020F
  • License MIT

Quickly generates a normal map based on a 2D heightmap

Package Exports

  • quick-normal-map

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (quick-normal-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

quick-normal-map experimental

quick-normal-map

Takes a 2D heightmap stored in an ndarray and generates a matching normal map.

Uses a method that is fast, but less accurate - I believe this approach works best :)

Usage

normal(heightmap, [options])

Generates a normal map.

  • heightmap should be a 2D ndarray, where each value corresponds to the height at that point.

  • options.output is an optional 3D ndarray to output to. If not supplied, one will be created. It's essentially the same size as the heightmap but with an added dimension for X/Y/Z rotation values. So the shape of this ndarray should be equivalent to:

    [heightmap.shape[0], heightmap.shape[1], 3]
  • options.xzscale The scale of the horizontal planes. Defaults to 1.

  • options.yscale The scale of the vertical plane. Defaults to 1.

  • options.wrap a boolean for whether the heightmap is tiling and the normal map should wrap around the edges. Defaults to true.