shader-graph-best-practices

Installation
SKILL.md

Shader Graph Best Practices for Mobile Unity

TRIGGER

Use this skill when the user is working with Unity Shader Graph (the node-based visual shader editor) for URP or HDRP. Triggers include: "Shader Graph", "node-based shader", "sub-graph", "custom function node", "Shader Graph mobile", "Shader Graph optimization", "custom lighting Shader Graph", "Shader Graph precision", or any visual shader authoring workflow in Unity. Also trigger when the user references Ben Cloward, Cyanilux, or Daniel Ilett Shader Graph tutorials.


CORE RULES

  1. Keep node count under 100 for mobile targets. Each node compiles to shader instructions. Above ~100 nodes, mobile GPUs hit instruction cache limits and performance drops sharply. Use Sub Graphs to organize, but they don't reduce instruction count.

  2. Set graph-level precision to Half for mobile. In the Graph Inspector, change Precision to "Half". Override individual nodes to "Float" only for positions and UVs.

  3. Use Sub Graphs to organize, not to optimize. Sub Graphs improve readability but compile inline — they don't reduce instruction count. However, they enable reuse across graphs, which reduces total project maintenance.

  4. Custom Function nodes are the escape hatch. When Shader Graph can't express something efficiently (or uses too many nodes for a simple operation), write a Custom Function node in HLSL. This is especially useful for lighting access, complex math, and platform-specific branching.

  5. Shader Graph generates all required passes automatically (ForwardLit, ShadowCaster, DepthOnly, DepthNormals, Meta). You don't need to worry about multi-pass like in HLSL — but you also can't optimize individual passes.

Installs
36
GitHub Stars
9
First Seen
Mar 28, 2026
shader-graph-best-practices — adevra/unity-shader-agent-skills