Skip to content

LeoYeAI/agent-master-skills / skills/animation-shader

animation-shader

Verified

READ this skill when implementing or configuring animation-style shaders (Toon/Cel Shaders) — including outlines, rim lighting, toon shading, MatCap, emission, dissolve, hatching, or any stylized rendering effect. Contains preset styles and feature-to-reference mappings for lilToon, Poiyomi, UTS2, RToon, SToon, and ToonShadingCollection. Works as a domain knowledge plugin alongside workflow skills (OpenSpec, SpecKit) or plan mode of an agent.

FileKindSize
SKILL.mdskill md17.0 KB
_meta.jsonconfig285 B
references/PoiyomiShaders/Details/01_Base_Main.mdmarkdown4.8 KB
references/PoiyomiShaders/Details/02_Lighting_Shadows.mdmarkdown4.9 KB
references/PoiyomiShaders/Details/03_Surface_Reflections.mdmarkdown3.9 KB
references/PoiyomiShaders/Details/04_Special_Effects.mdmarkdown3.4 KB
references/PoiyomiShaders/Details/05_Outline.mdmarkdown2.6 KB
references/PoiyomiShaders/Features.mdmarkdown2.1 KB
references/RToon/Details/01_Core_Shading.mdmarkdown5.3 KB
references/RToon/Details/02_ShadowT.mdmarkdown3.1 KB
references/RToon/Details/03_Outline.mdmarkdown4.6 KB
references/RToon/Details/04_MatCap_Reflection.mdmarkdown3.6 KB
references/RToon/Details/05_Gloss_Rim.mdmarkdown3.2 KB
references/RToon/Details/06_Advanced_Features.mdmarkdown3.3 KB
references/RToon/Features.mdmarkdown4.2 KB
references/SToon/Details/01_Core_Shading.mdmarkdown3.4 KB
references/SToon/Details/02_Outline.mdmarkdown2.9 KB
references/SToon/Details/03_Overlays.mdmarkdown3.1 KB
references/SToon/Details/04_Specular_Rim.mdmarkdown2.7 KB
references/SToon/Details/05_Artistic_Controls.mdmarkdown3.2 KB
references/SToon/Features.mdmarkdown2.6 KB
references/ToonShadingCollection/Details/01_ArtStyles.mdmarkdown2.5 KB
references/ToonShadingCollection/Details/02_Outline.mdmarkdown4.4 KB
references/ToonShadingCollection/Details/03_Diffuse.mdmarkdown4.5 KB
references/ToonShadingCollection/Details/04_Specular.mdmarkdown3.2 KB
references/ToonShadingCollection/Details/05_Environment.mdmarkdown3.1 KB
references/ToonShadingCollection/Details/06_PBR_Stylization.mdmarkdown4.6 KB
references/ToonShadingCollection/Details/07_Stylized_Features.mdmarkdown4.0 KB
references/ToonShadingCollection/Details/08_PostProcessing.mdmarkdown3.5 KB
references/ToonShadingCollection/Details/09_Lighting_Shadows.mdmarkdown3.1 KB
references/ToonShadingCollection/Details/10_Animation_VFX.mdmarkdown3.7 KB
references/ToonShadingCollection/Details/11_Modeling_Pipeline.mdmarkdown2.9 KB
references/ToonShadingCollection/Features.mdmarkdown2.1 KB
references/UnityChanToonShaderVer2/Details/01_DoubleShade.mdmarkdown3.6 KB
references/UnityChanToonShaderVer2/Details/02_ShadingGradeMap.mdmarkdown3.1 KB
references/UnityChanToonShaderVer2/Details/03_Outline.mdmarkdown2.7 KB
references/UnityChanToonShaderVer2/Details/04_SpecialFeatures.mdmarkdown3.6 KB
references/UnityChanToonShaderVer2/Features.mdmarkdown5.6 KB
references/lilToon/Details/01_Base_Main.mdmarkdown4.8 KB
references/lilToon/Details/02_Lighting_Shadows.mdmarkdown3.9 KB
references/lilToon/Details/03_Surface_Reflections.mdmarkdown4.2 KB
references/lilToon/Details/04_Special_Effects.mdmarkdown4.7 KB
references/lilToon/Details/05_Advanced.mdmarkdown3.9 KB
references/lilToon/Details/06_Variants.mdmarkdown3.4 KB
references/lilToon/Details/07_Variant_Features.mdmarkdown4.8 KB
references/lilToon/Details/08_Outline.mdmarkdown3.3 KB
references/lilToon/Features.mdmarkdown3.3 KB
workflow-standalone.mdmarkdown6.4 KB

references/ToonShadingCollection/Details/02_Outline.md

View on GitHub
# Outline (描边/勾边)

描边主要分为外描边和内描边。通常需要多种方法配合。

## 1. 外描边 (Outer Outline)

### A. 基于视角的勾边 (Fresnel/Rim method)
**原理**: `dot(viewDir, normal)` 接近 0 时判定为边缘。
*   **基础公式**: `pow(dot(viewDir, normal), k)`。
*   **优点**: 极低开销,单 Pass,直接在 Base Pass 内计算。
*   **缺点**: 线宽不均匀(扁平处变宽,甚至覆盖整个面)。
*   **应用**: 水墨风格(如《大神》),或作为辅助风格化效果。

### B. 过程几何描边 (Inverted Hull / Back-face Extrusion)
**原理**: 也就是“背面膨胀法”。绘制两遍,第二遍剔除正面(`Cull Front`),顶点沿法线膨胀,输出纯色。
*   **基础公式**: `v.vertex.xyz += v.normal * _OutlineWidth;`
*   **优点**: 线宽均匀,控制灵活,效果稳定,易于分区指定颜色。
*   **缺点**: 双倍 DrawCall(需描边物体);很难对面片结构(如头发片)勾边。
*   **关键技巧**:
    *   **深度控制 (Z-Test)**: 描边 pass 放在 Base pass 后,利用 Z-Test 剔除被遮挡部分。
    *   **粗细控制**: 使用顶点色或 Mask 贴图控制局部粗细(如发梢变细,避免像火腿肠)。可以使用顶点色通道控制:宽度、Z偏移、颜色索引。
    *   **硬边断裂 (Hard Edge Split)**: 硬边处的顶点法线是分裂的,会导致描边断裂。
        *   *解决方案*: 在建模软件中将平滑法线烘焙到切线数据或顶点色中(Smoothed Normal),Shader 中沿这个平滑法线膨胀。
    *   **Z-Bias (Z偏移)**: 将背面顶点的 Z 值向相机方向微调,而不是沿法线膨胀。适用于某些难以膨胀的结构。
    *   **NDC 空间膨胀**: 将法线转到 NDC 空间再挤出(忽略深度方向),可以保持描边在屏幕上的视觉宽度一致(不随距离变细),也可以解决透视导致的粗细不均。

### C. 基于后处理的描边 (Post-Processing)
**原理**: 对屏幕图像进行边缘检测(Sobel, Roberts, Canny 算子),检测深度(Depth)、法线(Normal)或 ID 的不连续性。
*   **Sobel 算子逻辑**:
    ```glsl
    // 简单的 Sobel 边缘检测伪代码
    float2 kernel[9] = { ... }; // 3x3 卷积核
    float2 gradX = 0, gradY = 0;
    for(int i=0; i<9; i++) {
        float sample = tex2D(_CameraDepthTexture, uv + offset[i]).r;
        gradX += sample * kernelX[i];
        gradY += sample * kernelY[i];
    }
    float edge = sqrt(gradX*gradX + gradY*gradY);
    bool isEdge = edge > _Threshold;
    ```
*   **优点**: 性能开销固定(与物体数量无关),可同时处理内描边,适合场景建筑。
*   **缺点**: 难以控制局部粗细和颜色(容易出现过度描边);深度/法线检测需要额外 Pass 或 G-Buffer 支持;难以处理半透明物体。
*   **应用**: 《无主之地》场景描边,《崩坏3》背景描边。

---

## 2. 内描边 (Inner Outline)

### A. 贴图手绘
直接在 BaseMap 上画线。
*   **缺点**: 锯齿明显,精度受贴图分辨率限制,近看模糊。
*   **应用**: 《原神》部分细节使用了直接手绘。

### B. 本村线 (Motomura Line / UV Mapping)
利用 UV 映射技巧,将需要描边的边缘映射到贴图的直线上(通常是像素边缘)。
*   **原理**: 贴图上的水平/垂直线不会产生锯齿。将模型上需要描边的边缘 UV 拉直,对齐到贴图上的线条。
*   **优点**: 完美抗锯齿,节省贴图空间。
*   **缺点**: UV 展开极其困难,对模型拓扑有要求(主要用于 GUILTY GEAR 系列)。扭曲了 UV 空间,导致无法在这些区域绘制正常纹理。

### C. 独立 UV 壳
将描边部分拆分成独立的 UV 壳,集中排布到贴图的指定颜色区域。
*   **优点**: 比本村线简单,抗锯齿。
*   **缺点**: 增加模型面数(需要切分网格)。

### D. 几何检测 / 后处理遮罩分区
*   **顶点色分区**: 在角色不同部位(如皮肤与衣服交界)刷不同的顶点色 ID。
*   **后处理检测**: 后处理检测 ID 贴图或颜色贴图的色差,在交界处生成描边。
*   **优点**: 线条干净,动态可变。

---

## 3. 风格化描边
*   **水墨风**: 多次 Pass 叠加半透明描边 + 顶点随机偏移(Noise) + 噪点干扰。
*   **效果线**: 模拟素描线条或速度线,常用于特效或高动态画面(如《天元突破》风格)。
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall