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/05_Environment.md

View on GitHub
# Environment & Rim (环境与边缘光)

## 1. Indirect Reflection (环境反射)

卡通渲染通常弱化物理真实的反射,转而追求风格化的金属质感。

### A. 极简 Reflection Probe / Cubemap
*   **做法**: 使用精度极低、模糊的 Cubemap 或 Reflection Probe。
*   **风格**: 避免写实环境的割裂感,仅提供基本的环境色倾向(如《战双》)。反射贴图通常极其简化(几道区域光)。

### B. MatCap 伪反射 (MatCap Reflection)
*   **做法**: 使用 MatCap 贴图模拟金属反射(如《原神》金属)。
*   **原理**: 
    ```glsl
    // View Space Normal based UV
    float3 viewNormal = mul((float3x3)UNITY_MATRIX_V, worldNormal);
    float2 uv = viewNormal.xy * 0.5 + 0.5;
    fixed3 reflection = tex2D(_MatCapTex, uv).rgb;
    ```
*   **优点**:
    *   **形状可控**: 美术直接绘制理想的高光/反射形状,不再依赖物理光源位置。
    *   **层次丰富**: 可以在 MatCap 中画出中心亮、边缘暗、最外层又亮的复杂层次。
*   **缺点**: 视角固定,无法反映真实环境变化(但风格化渲染通常忽略这一点)。

### C. 边缘光模拟反射
*   **做法**: 类似于《碧兰幻想》,利用边缘光(Rim Light)配合材质边缘压暗,模拟金属边缘的反光感,无需真正的反射计算。

## 2. Rim Light (边缘光/勾边光)

边缘光用于在物体边缘勾勒轮廓,常用于模拟逆光效果或提升角色与背景的对比度。

### A. 基础算法
基于菲涅尔效应 (Fresnel)。
*   **公式**: `rim = 1.0 - saturate(dot(viewDir, normal));`
*   **硬边化**: `rim = smoothstep(threshold, threshold + feather, rim);`

### B. 出现条件控制
*   **亮部/暗部限制**:
    *   **仅亮部**: `rim *= saturate(dot(normal, lightDir));` (增强受光面轮廓)。
    *   **仅暗部**: `rim *= (1.0 - saturate(dot(normal, lightDir)));` (模拟逆光透射)。
*   **方向性 (Directional Rim)**: 仅在主光方向(或特定方向)产生边缘光。
    ```glsl
    // 偏移法线采样
    float rimDot = dot(normal, lightDir + offsetDir);
    ```

### C. 颜色设计
*   **环境色**: 使用环境光颜色作为 Rim Color,使角色融入环境。
*   **补光色**: 使用主光的对补色。
*   **双色**: 左右两侧使用不同的边缘光颜色。

### D. 特殊问题处理
*   **双面渲染**: 对于双面渲染的物体(如裙摆内部),`dot(N, V)` 可能为负,导致全亮。
    *   *修正*: 使用 `1.0 - abs(dot(viewDir, normal))`。
*   **屏幕空间边缘光 (Screen Space Rim)**:
    *   **原理**: 类似于深度描边,通过偏移屏幕坐标采样深度图来计算边缘光。
    *   **优点**: **等宽**,不会像菲涅尔算法那样在平坦表面出现大面积反光(如《原神》的均匀边缘光)。
    *   **实现**: 向 View-Space 法线方向偏移 UV 采样深度,若深度差大于阈值则为边缘。

### E. 遮蔽 (Masking)
*   **AO 遮蔽**: 使用 AO 贴图遮蔽褶皱深处的边缘光,防止“发光褶皱”。
*   **Shadow 遮蔽**: 处于阴影(ShadowMap)中的物体是否应该有边缘光?通常保留,但需压暗。
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