program-game-shaders

Installation
SKILL.md

Program Game Shaders

Author deterministic, GPU-friendly vertex and fragment shaders across GLSL, HLSL, and engine shader graphs while preventing warp divergence and fragment overdraw.

Core Rules

  • Branchless ALU Operations: Eliminate dynamic if/else branching inside fragment shaders where condition variables vary per pixel. Use hardware intrinsics (step(), smoothstep(), mix() / lerp(), clamp()) to preserve GPU SIMD wave occupancy.
  • Precision & Coordinate Discipline: Declare explicit precision qualifiers (highp for world/UV coordinates, mediump or half for color/normals on mobile). Explicitly document coordinate space transitions (Object, World, View, Clip, Screen, Tangent).
  • Overdraw & Depth Preservation: Avoid discarding fragments (discard / clip()) in opaque passes when alpha blending or early-Z rejection can be preserved, as pixel discards disable hardware Early-Z optimizations on tile-based mobile GPUs.
  • Contract Adherence: Emit contracts/schemas/implementation-result.json upon completing shader and material pipeline implementations.

Suggested Process

1. Coordinate Space & Vertex Displacement

Perform geometric deformations (foliage wind sway, wave displacement, billboarding) in the vertex shader rather than per-pixel when mesh tessellation is sufficient:

  • Transform vertices from local space to world space, apply periodic displacement offsets, and project back to clip space.
  • Recompute or approximate perturbed vertex normals for accurate downstream lighting.
Installs
4
GitHub Stars
5
First Seen
Oct 26, 2026