metal-shader-expert

Writes and debugs Metal Shading Language shaders for Apple GPU rendering pipelines.

70|4|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/AlexW00/Zettel --skill metal-shader-expert-alexw00
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: metal-shader-expert
Source: https://github.com/AlexW00/Zettel/tree/main/.agents/skills/metal-shader-expert
Command: npx skills add https://github.com/AlexW00/Zettel --skill metal-shader-expert-alexw00

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct, performant Metal shaders requires deep knowledge of Apple's Tile-Based Deferred Rendering architecture, precision tradeoffs, and GPU debugging techniques that most developers lack. ## Core Features & Use Cases - MSL Shader Authoring: Write vertex, fragment, compute, tile, and ray tracing shaders following Apple Silicon best practices like half-precision defaults and function constants. - PBR & Procedural Effects: Implement Cook-Torrance BRDF lighting, FBM noise, Voronoi patterns, and domain warping using the included reference implementations. - GPU Debugging & Optimization: Apply heat maps, overdraw visualization, NaN detection, and occupancy analysis to diagnose rendering and performance issues. - Use Case: Ask for a physically based fragment shader for an iOS app, and receive a complete MSL implementation with energy-conserving BRDF, tone mapping, and half-precision optimization. ## Quick Start Write a Metal fragment shader that renders animated flowing marble using FBM noise with a purple-to-gold color gradient.

Frequently Asked Questions about metal-shader-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a PBR fragment shader in Metal?▼

Implement the Cook-Torrance BRDF with GGX normal distribution, Smith geometry function, and Fresnel-Schlick approximation. The skill's pbr-shaders reference provides a complete MSL implementation including light accumulation, Reinhard tone mapping, and gamma correction.

Should I use float or half precision in Metal shaders?▼

Default to half precision for colors, normals, and most calculations on Apple GPUs, since it reduces register pressure and bandwidth. Reserve float for world positions, depth values, and cumulative calculations where precision matters.

Can I use this for WebGL or GLSL shader development?▼

No, this skill targets Metal Shading Language and Apple GPU architecture only. WebGL/GLSL has different constraints, CUDA is NVIDIA-only, and OpenGL has been deprecated on Apple platforms since 2018.

How do I debug NaN values in Metal shaders?▼

Use a NaN check function that returns magenta for NaN values and cyan for infinity, making errors visually obvious. Combine this with Xcode GPU Capture, heat map visualizations, and debug visualization modes for normals, UVs, and depth.

Why is my Metal shader slow on Apple Silicon?▼

Common causes include using float everywhere instead of half, runtime branching instead of function constants, and ignoring TBDR architecture. Reduce texture bandwidth, minimize divergent branches with select(), and profile with Xcode GPU Capture.