원클릭으로
shader-graph-best-practices
Node budgets, custom lighting, sub-graphs, precision control, and mobile workflows for Unity Shader Graph
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Node budgets, custom lighting, sub-graphs, precision control, and mobile workflows for Unity Shader Graph
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | shader-graph-best-practices |
| description | Node budgets, custom lighting, sub-graphs, precision control, and mobile workflows for Unity Shader Graph |
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.
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.
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.
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.
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.
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.
Shader Graph's default Lit target uses PBR (Physically Based Rendering). For mobile, you often want simpler lighting. Use Cyanilux's custom lighting sub-graphs:
The Cyanilux/URP_ShaderGraphCustomLighting package adds these sub-graph nodes to Shader Graph:
saturate(dot(Normal, LightDirection)) * LightColorThis gives you full control over lighting complexity — critical for mobile where PBR's multi-texture GGX/Smith BRDF is often too expensive.
BAD: Multiply → Add → Multiply → Saturate (4 nodes)
GOOD: Custom Function node with: saturate(a * b + c) * d (1 node)
The ShaderGraphVariables package adds Register Variable and Get Variable nodes. This prevents recalculating the same value multiple times in complex graphs — the equivalent of a local variable in code.
texture-packing-variant-stripping skill)| Node | Cost | Alternative |
|---|---|---|
| Fresnel Effect | Medium | Manual: 1 - saturate(dot(ViewDir, Normal)) then Power |
| Voronoi | High | Pre-bake to texture |
| Gradient Noise | High | Use Simple Noise or pre-bake to texture |
| Triplanar | High (3 texture samples) | Use on specific meshes only, not terrain |
| Normal From Height | High | Use actual normal maps instead |
| Custom Render Texture | High | Pre-bake when possible |
Unity 6 introduced Full Screen Shader Graph for post-processing effects. Use with URP's Full Screen Pass Renderer Feature:
Mobile consideration: Each Full Screen pass is a full-screen blit. Combine effects into a single Full Screen graph whenever possible.