- Home
- Skills
- Bbeierle12
- Skill Mcp Claude
- Shader Sdf
shader-sdf_skill
- JavaScript
6
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill bbeierle12/skill-mcp-claude --skill shader-sdf- _meta.json382 B
- SKILL.md9.1 KB
Overview
This skill provides a compact GLSL toolkit for building Signed Distance Functions (SDFs) for 2D and 3D. It includes common shape primitives, boolean ops (union, intersection, subtraction), smooth blends, domain transforms (repeat, twist, bend), and a basic raymarching example for rendering. Use it to rapidly prototype procedural shapes, text effects, smooth morphs, and raymarched scenes.
How this skill works
Each function returns a signed distance: negative inside, positive outside, zero on the surface. Primitives (circle, box, sphere, torus, etc.) compute distance fields for single shapes. Operators combine or modify those fields: boolean ops pick min/max, smooth ops blend with a control parameter, and domain ops repeat or deform space before evaluating a primitive. The raymarch loop steps along a ray by the distance value from the map function and resolves surface normals via numerical gradient sampling.
When to use it
- Creating crisp or anti-aliased 2D procedural shapes and outlines
- Building smooth blends and morphs between primitives
- Designing repeating patterns, tiles, or mirrored compositions
- Prototyping raymarched 3D scenes and lighting with SDFs
- Implementing text effects, glows, drop shadows, and outlines
Best practices
- Keep epsilon and step counts conservative in raymarching to balance quality and performance
- Use fwidth-based anti-aliasing for smooth edges on low-resolution targets
- Prefer smooth boolean ops with an explicit k parameter to avoid hard intersections
- Apply transforms to the point before evaluating primitives (p -= offset, rotate, scale)
- Clamp repetition and limited repeats to avoid infinite loops or extreme tesselation costs
Example use cases
- 2D logo built from repeated rounded boxes and rings with smooth unions for soft joins
- Procedural star or polygon masks for UI elements with anti-aliased outlines
- Raymarched scene of a sphere fused to a box with smooth subtraction cavities
- Animated twist or bend deformation applied over time for morphing shapes
- Repeating tileable 3D columns using limited repetition and capsule primitives
FAQ
Use smoothstep with fwidth(d) for anti-aliased edges and smoothstep on abs(d) to create outlines; adjust thresholds for thickness.
When should I use smooth unions instead of plain min()?
Use smooth unions when you want soft joins or rounded blends between shapes; tune the k parameter to control blend radius.