Skip to content

Instantly share code, notes, and snippets.

View rimnaarith's full-sized avatar
😉
Focusing

Naarith rimnaarith

😉
Focusing
View GitHub Profile
import * as THREE from "three/webgpu";
import * as TSL from "three/tsl";
export const sdBox = TSL.Fn(
([p, b]: [THREE.Node<"vec3">, THREE.Node<"vec3">]) => {
const q = TSL.abs(p).sub(b);
return TSL.length(TSL.max(q, 0.0)).add(
TSL.min(TSL.max(q.x, TSL.max(q.y, q.z)), 0.0),
);