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

@promontis/threejs-pom

v0.1.0

Published

Three.js WebGPU TSL surface material with parallax occlusion mapping (POM).

Readme

@promontis/threejs-pom

npm version npm downloads bundle size license demo

A Three.js WebGPU TSL surface material with built-in parallax occlusion mapping (POM). Drop in your standard PBR maps (albedo, normal, roughness, AO, height, metalness) and get a node material with a real ray-marched height field — not just a normal map fake — running entirely on the GPU.

[!NOTE] POM uses the parallaxDirection TSL node and runs on the WebGPU renderer. It requires a browser with WebGPU enabled and a Three.js build that includes the three/webgpu and three/tsl entry points.

Try it

Live demo: https://promontis.github.io/threejs-pom/

The demo lets you browse Poly Haven and PBRPX textures, swap PBR maps live, and play with depth, tiling, and lighting. POM is automatically disabled for assets without a displacement map.

Install

npm install @promontis/threejs-pom three

three is a peer dependency — bring your own version (>=0.180.0).

Quick start

import * as THREE from 'three/webgpu';
import { createPomMaterial } from '@promontis/threejs-pom';

const loader = new THREE.TextureLoader();

const material = createPomMaterial({
  albedo:    loader.load('/textures/brick_albedo.jpg'),
  normal:    loader.load('/textures/brick_normal.jpg'),
  roughness: loader.load('/textures/brick_roughness.jpg'),
  height:    loader.load('/textures/brick_height.png'),
  // ao, metalness are also supported and optional
  depth:  0.025, // parallax depth in UV units (default 0.025)
  repeat: 1,     // UV tiling multiplier (default 1)
});

const mesh = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), material);
mesh.rotation.x = -Math.PI / 2;
scene.add(mesh);

// Tweak live without rebuilding the material:
material.pom.depth.value  = 0.05;
material.pom.repeat.value = 2;

[!TIP] The renderer must be a THREE.WebGPURenderer. POM relies on the TSL parallaxDirection node, which is only available on the WebGPU pipeline.

API

createPomMaterial(options): PomMaterial

Returns a THREE.MeshStandardNodeMaterial wired up for PBR with optional parallax occlusion mapping. Texture color space, wrapping, and anisotropy are configured for you — pass raw THREE.Texture instances straight from your loader.

type PomMaterialOptions = {
  albedo:     THREE.Texture;
  normal?:    THREE.Texture;
  roughness?: THREE.Texture;
  ao?:        THREE.Texture;
  height?:    THREE.Texture;
  metalness?: THREE.Texture;

  /** Parallax depth in UV units. Default 0.025. Useful range: 0.005 – 0.1. */
  depth?:  number;
  /** UV repeat multiplier (tiling). Default 1. */
  repeat?: number;
};

POM is enabled automatically when height is supplied, and skipped otherwise.

The returned material has a .pom field with live uniforms — assign to .value to tweak at runtime without rebuilding the shader graph:

material.pom.depth.value  = 0.04;
material.pom.repeat.value = 4;

How the POM works

The shader is implemented entirely in TSL:

  1. The view direction is transformed into tangent space using the built-in parallaxDirection node.
  2. A Loop (24–40 layers depending on grazing angle) ray-marches into the height field until it intersects the surface.
  3. A 5-step refinement loop bisects the last segment for sub-layer precision.
  4. UVs that escape the [0, 1] range after marching are discard-ed, so the silhouette correctly reveals occlusion at the geometry edges.

See src/pomMaterial.ts for the full implementation — it is intentionally short and self-contained (~150 LOC).

React Three Fiber example

import { Canvas, useLoader } from '@react-three/fiber';
import { useEffect, useMemo } from 'react';
import * as THREE from 'three/webgpu';
import { createPomMaterial } from '@promontis/threejs-pom';

function Surface({ urls, depth, repeat }) {
  const [albedo, normal, roughness, height] = useLoader(THREE.TextureLoader, [
    urls.albedo,
    urls.normal,
    urls.roughness,
    urls.height,
  ]);

  // Recreate only when the texture set changes; depth and repeat live as uniforms.
  const material = useMemo(
    () => createPomMaterial({ albedo, normal, roughness, height, depth, repeat }),
    [albedo, normal, roughness, height],
  );

  useEffect(() => { material.pom.depth.value = depth; },  [material, depth]);
  useEffect(() => { material.pom.repeat.value = repeat; }, [material, repeat]);

  return (
    <mesh rotation={[-Math.PI / 2, 0, 0]}>
      <planeGeometry args={[10, 10]} />
      <primitive object={material} attach="material" />
    </mesh>
  );
}

Browser support

@promontis/threejs-pom runs on the WebGPU renderer. Today that means:

| Browser | Status | |--------------------|--------| | Chrome / Edge ≥113 | ✅ | | Safari TP / 17.4+ | ✅ | | Firefox | Behind dom.webgpu.enabled |

Chrome can hide navigator.gpu on http://0.0.0.0, LAN URLs, embedded previews, or when hardware acceleration is disabled. Use http://localhost for development.

Contributing

PRs welcome! See CONTRIBUTING.md for the project layout and dev setup. The repo is split into two folders:

  • src/ — the published library (@promontis/threejs-pom)
  • demo/ — the WebGPU viewer deployed to GitHub Pages

License

MIT © Promontis. See LICENSE for the full text and THIRD_PARTY_NOTICES.md for upstream acknowledgements.