A three.js WebGPU shader that adds silhouette parallax occlusion mapping to carve height-field relief outlines on flat geometry.

Stars

32

7-day growth

No data

Forks

0

Open issues

0

License

MIT

Last updated

2026-07-25

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

Delivers AAA-style shell-mapped surface effects on flat geometry, with silhouette clipping and self-shadowing, all in a single TSL function.

Who it is for

  • three.js developers
  • WebGPU enthusiasts
  • game developers using three.js
  • shader programmers

Use cases

  • Creating detailed relief surfaces on low-poly geometry
  • Adding parallax occlusion mapping with silhouette overhangs
  • Implementing self-shadowing height-field materials
  • Prototyping shell-mapping effects for WebGPU

Strengths

  • Single TSL function with configurable silhouette modes
  • Self-shadowing with soft penumbra
  • Procedural height maps, no texture assets needed
  • Upstream candidate to three.js

Considerations

  • Requires WebGPU-capable browser (Chrome/Edge)
  • Requires geometry tangents via computeTangents()
  • Normal node compiles in separate sub-build

README quick start

Silhouette Parallax Occlusion Mapping for three.js (WebGPU / TSL)

Height-field relief that carves the outline of your meshes — not just their interiors. A single TSL function ray-marches a height map and clips the silhouette through the alpha-test path, so relief overhangs the geometry it sits on, in the spirit of the shell-mapped surfaces in modern AAA titles (and the classic prism / shell mapping papers).

This shader is is a threejs webgpu TSL implementation of the same kind of SPOM/POM techniques popularly used in the game Crimson Desert.

Live demo (WebGPU-capable browser required, e.g. Chrome/Edge) · Open in StackBlitz

Everything in this scene is flat geometry. The blast door is a recessed height field on a plane; the wall's outline crenellates along its relief trim; the flanges and bolts on the columns and pipes overhang the cylinders they wrap. All height maps are generated procedurally at startup — there are no texture assets.

Run it

Any static file server works (WebGPU requires a secure context — localhost is fine):

npx serve .
# or: python -m http.server 8080

Then open the served index.html in a WebGPU-capable browser (Chrome/Edge). three.js is pulled from the jsDelivr CDN, pinned to 0.185.1.

The addon

ParallaxOcclusion.js exports one function:

import { parallaxOcclusionUV } from './ParallaxOcclusion.js';

const pom = parallaxOcclusionUV( heightMap, {
	uvNode: uv(),          // base UVs (scale/offset them for tiling)
	scale: 0.1,            // relief depth, in UV units
	minLayers: 16,         // march steps head-on ...
	maxLayers: 96,         // ... and at grazing angles
	silhouette: true,      // compute the coverage / missed outputs
	silhouetteBounds: [ 0, 1 ],   // clip rays landing outside this UV region
	curvedSilhouette: false,      // clip rays passing a curved surface's horizon
	curvature: null,       // number | [ku, kv] | (uv) => node - see JSDoc
	sampleBounds: null     // clamp every height fetch into a UV region
} );

material.colorNode = pom.sample( colorMap ); // gradient-safe sampling at the marched UV
material.normalNode = /* build from a second parallaxOcclusionUV() call -

Description

Silhouette parallax occlusion mapping for three.js WebGPU/TSL - relief that carves mesh outlines, with a fully procedural demo scene

Related repositories

Similar projects matched by category, topics, and programming language.

ddosi
Featured
ddosi GitHub avatar

PacketLens

PacketLens is a pure front-end, offline pcap analysis tool that runs entirely in the browser, supporting deep protocol decoding, HTTPS decryption, and million-packet instant loading without any backend.

HTML
19
ViffyGwaanl
Featured
ViffyGwaanl GitHub avatar

kimi-k3-learn

An interactive learning system that turns the 47-page Kimi K3 technical report into a single offline HTML file with running algorithms, 3D visualizations, spaced repetition quizzes, and a smart highlighting QA tool.

AI & Machine Learning
15
iamtechartist
Featured
iamtechartist GitHub avatar

human-cell-visualizer

An interactive 3D visualization of three human cell types using Three.js, WebGL particles, and custom GLSL shaders, allowing users to rotate, zoom, morph, and explore annotated structures.

Design & Creative
13