跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

unity-graphics

Unity 6 graphics and rendering guide. Use when working with render pipelines (URP, HDRP, Built-in), shaders, Shader Graph, materials, textures, cameras, post-processing, or rendering optimization. Covers Render Graph, batching, draw call optimization, and GPU instancing. Based on Unity 6.3 LTS documentation.

Nice-Wolf-Studio · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add Nice-Wolf-Studio/unity-claude-skills --skill unity-graphics

技能说明


name: unity-graphics description: > Unity 6 graphics and rendering guide. Use when working with render pipelines (URP, HDRP, Built-in), shaders, Shader Graph, materials, textures, cameras, post-processing, or rendering optimization. Covers Render Graph, batching, draw call optimization, and GPU instancing. Based on Unity 6.3 LTS documentation. globs:

  • "**/*.shader"
  • "**/*.hlsl"
  • "**/*.shadergraph"
  • "**/*.shadersubgraph"
  • "**/*.mat"

Unity Graphics and Rendering

Render Pipeline Selection Guide

A render pipeline performs a series of operations that take the contents of a scene and displays them on a screen. Unity provides three render pipelines:

CriteriaBuilt-in Render PipelineUniversal Render Pipeline (URP)High Definition Render Pipeline (HDRP)
TargetLegacy projectsMobile to high-end consoles/PCsAAA, automotive, architectural
CustomizationLimitedScriptable, extensible via Renderer FeaturesScriptable, Custom Passes, Full Frame Settings
Rendering PathsForward, DeferredForward, Forward+, DeferredForward, Deferred (hybrid tile/cluster)
Shader AuthoringShaderLab + Surface ShadersShader Graph (recommended), HLSLShader Graph (recommended), HLSL
SRP BatcherNoYesYes
Ray TracingNoNoYes (DXR)
VolumetricsNoNoYes (fog, clouds)
Anti-AliasingMSAAFXAA, SMAA, TAA, MSAAFXAA, SMAA, TAA, MSAA
PlatformsAllAll (scalable)High-end (DX11/12, Metal, Vulkan)
GPU RequirementStandardStandardCompute shader capable

Decision flow:

  1. Need ray tracing, volumetric clouds, or physically-based sky? --> HDRP
  2. Need to target mobile, WebGL, or widest platform range? --> URP
  3. Maintaining a legacy project with no migration budget? --> Built-in
  4. Starting a new project? --> URP (most projects) or HDRP (high fidelity)

Warning: Render pipelines are NOT interchangeable. Materials, shaders, and post-processing from one pipeline do not work in another without conversion. Upgrading Built-in materials to URP/HDRP requires the pipeline's material upgrader; objects render bright pink if their shader is incompatible.

Source: Render Pipelines

URP (Universal Render Pipeline)

URP is a prebuilt Scriptable Render Pipeline made by Unity for creating optimized graphics across a range of platforms, from mobile to high-end consoles and PCs.

Key features:

  • Forward, Forward+, and Deferred rendering paths
  • Anti-aliasing: FXAA, SMAA, TAA, MSAA
  • 2D Renderer for 2D games
  • Renderer Features for custom rendering injection
  • SRP Batcher for draw call optimization
  • Built-in post-processing via Volume system

See: references/urp-guide.md Source: URP

HDRP (High Definition Render Pipeline)

HDRP is a prebuilt Scriptable Render Pipeline targeting AAA-quality games, automotive demos, and architectural visualization on high-end hardware. It requires compute shader-capable GPUs (DirectX 11/12, Metal, Vulkan).

Key features:

  • Physically-based lighting with Physical Light Units
  • Material types: Lit, StackLit, Layered Lit, Hair, Fabric, Eye, AxF, Terrain
  • Ray tracing: reflections, GI, shadows, AO, subsurface scattering
  • Volumetric fog and volumetric clouds
  • Physically Based Sky, HDRI Sky, Gradient Sky
  • Path tracing with denoising (Optix, Intel Open Image Denoise)
  • Water system with caustics and underwater rendering
  • Dynamic resolution with DLSS, FSR 1.0, TAA Upscaling

See: references/hdrp-guide.md Source: HDRP

Shader Graph

Shader Graph enables building shaders visually by creating and connecting nodes in a graph framework instead of writing code. Changes are reflected with instant feedback.

Render pipeline compatibility:

PipelineSupported
URPYes
HDRPYes
Built-in Render PipelineYes
Custom SRPNo

Shader Graph is included automatically when you install URP or HDRP.

Custom Function Node -- Inject custom HLSL code into Shader Graphs:

  • String mode: Write HLSL directly; use $precision token for half/float
  • File mode: Reference external .hlsl files with include guards
// File mode example with include guards
//UNITY_SHADER_NO_UPGRADE
#ifndef MYHLSLINCLUDE_INCLUDED
#define MYHLSLINCLUDE_INCLUDED

void MyFunction_float(float3 A, float B, out float3 Out)
{
    Out = A + B;
}
#endif //MYHLSLINCLUDE_INCLUDED

Pipeline detection in Custom Function nodes:

#ifdef SHADERGRAPH_PREVIEW
    half3 color = half3(0,0,0);
#else
    #if defined(UNIVERSAL_PIPELINE_CORE_INCLUDED)
        half4 shadowCoord = TransformWorldToShadowCoord(WorldPosition);
        Light mainLight = GetMainLight(shadowCoord);
        half3 color = mainLight.color;
    #else
        half3 color = half3(0, 0, 0);
    #endif
#endif

Conditional keywords by pipeline:

  • Built-in: BUILTIN_PIPELINE_CORE_INCLUDED
  • URP: UNIVERSAL_PIPELINE_CORE_INCLUDED
  • HDRP: UNITY_HEADER_HD_INCLUDED
  • Preview window: SHADERGRAPH_PREVIEW

See: references/shader-graph.md Source: Shader Graph

Shaders

A shader is a program that runs on the GPU. Unity categorizes shaders into three types:

  1. Graphics Pipeline Shaders -- Most common; work with Shader objects to determine scene appearance
  2. Compute Shaders -- Perform GPU calculations outside the regular graphics pipeline
  3. Ray Tracing Shaders -- Handle ray tracing calculations (HDRP only)

Key terminology:

  • Shader Object -- Instance of the Shader class wrapping shad
阅读完整来源 ↗