gpu-algorithms-expert

Optimizes GLSL ES 3.0 shaders using branchless math, raymarch acceleration, and numerical stability techniques.

Updated Jul 13, 2026
One-click install
npx skills add https://github.com/Ohmnia/site-build --skill gpu-algorithms-expert-ohmnia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpu-algorithms-expert
Source: https://github.com/Ohmnia/site-build/tree/main/.opencode/skills/gpu-algorithms-expert
Command: npx skills add https://github.com/Ohmnia/site-build --skill gpu-algorithms-expert-ohmnia

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing procedural shaders that are both visually rich and fast on the GPU is difficult: naive GLSL code wastes ALU cycles, uses expensive transcendental functions, branches unpredictably, and produces numerical artifacts. This Skill provides senior-level GPU engineering guidance to make shaders faster, cleaner, and more stable without sacrificing artistic intent. ## Core Features & Use Cases - Branchless & Vectorized GLSL: Replaces if-statements with step, smoothstep, mix, and clamp, and restructures scalar math into vector operations for better GPU throughput. - Raymarch & SDF Optimization: Applies sphere tracing, adaptive step sizes, bounding volumes, hierarchical distance fields, and early-exit conditions to minimize distance evaluations. - Numerical Stability & Precision Control: Guards against NaN, division by zero, and precision drift using epsilon values, highp/mediump selection, and periodic normalization. - Use Case: You have a raymarched fractal shader running at low frame rates on mobile. Use this Skill to restructure the march loop with bounding volumes, reduce iterations from 256 to 96, cache repeated trigonometric evaluations, and replace nested FBM with a cheaper noise model. ## Quick Start Ask the agent to review and optimize your GLSL raymarching shader for performance and numerical stability while preserving its visual appearance.

Frequently Asked Questions about gpu-algorithms-expert

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

FAQPage Schema
How do I optimize a GLSL raymarching shader for performance?

Use sphere tracing with adaptive step sizes, terminate loops early on surface hits or maximum distance, and add bounding volumes before evaluating expensive geometry. Budget 32-96 iterations for most scenes instead of brute-force 256-step loops.

How to write branchless shader code in GLSL?

Replace if-statements with step, smoothstep, mix, clamp, min, max, sign, and abs functions. GPUs execute branchless code more efficiently because warps avoid divergent execution paths.

When should I use highp versus mediump precision in GLSL ES?

Use highp for raymarching, distance fields, camera calculations, and fractals where precision loss causes visible artifacts. Reserve mediump for color and lighting math where precision loss is invisible, since lower precision improves performance on mobile GPUs.

Why does my raymarched shader produce NaN or flickering artifacts?

Artifacts come from division by zero, negative square roots, or accumulated floating-point error. Add small epsilon offsets, clamp intermediate values, normalize vectors periodically, and avoid catastrophic cancellation in distance estimators.

What are the limitations of nested FBM noise in raymarch loops?

Nested FBM inside raymarch loops multiplies cost per step and rarely justifies its visual gain. Compute noise once outside the loop, reuse warped coordinates, and choose the simplest noise type (hash, value, or gradient) that achieves the required appearance.