一个用于 three.js 的 WebGPU 着色器,通过视差遮挡映射在平面上雕刻高度场的浮雕轮廓。

Stars

32

7 天增长

暂无数据

Fork 数

0

开放 Issue

0

开源协议

MIT

最近更新

2026-07-25

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

在平坦几何体上实现 AAA 级壳映射表面效果,支持轮廓裁剪和自阴影,全部集成在一个 TSL 函数中。

适合谁使用

  • three.js 开发者
  • WebGPU 爱好者
  • 使用 three.js 的游戏开发者
  • 着色器程序员

典型使用场景

  • 在低多边形几何体上创建精细浮雕表面
  • 添加带轮廓悬垂的视差遮挡映射
  • 实现高度场材质的自阴影
  • 为 WebGPU 原型制作壳映射效果

项目优势

  • 单个 TSL 函数,可配置多种轮廓模式
  • 带软半影的自阴影
  • 程序化生成高度图,无需纹理资源
  • 已提交给 three.js 作为候选贡献

使用前须知

  • 需要支持 WebGPU 的浏览器(Chrome/Edge)
  • 需要几何体切线(computeTangents())
  • 法线节点需要在单独子构建中编译

README 快速开始

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 -

项目描述

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

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

ddosi
精选
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
17
ViffyGwaanl
精选
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 与机器学习
15
iamtechartist
精选
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.

设计与创意
13