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/RToon/Details/04_MatCap_Reflection.md

View on GitHub
# MatCap & Reflection (材质捕获与反射)

RToon 提供了强大的 MatCap 功能用于模拟金属光泽,以及一种伪造的环境反射(FReflection)用于风格化。

## 1. MatCap (Material Capture)

### Properties (参数)
*   `_MCap` ("MatCap", 2D): MatCap 纹理。
*   `_MCapIntensity` ("Intensity"): 强度。
*   `_MCapMask` ("Mask"): 遮罩贴图。
*   `_SPECMODE` ("Specular Mode"): **[关键]** 混合模式。
    *   **Off (Mult/Mix)**: MatCap 颜色与 MainColor 混合(正片叠底或加权)。适合模拟整体材质感。
    *   **On (Add)**: MatCap 颜色叠加(Add)。适合模拟高光。
*   `_SPECIN` ("Specular Power"): 仅在 `_SPECMODE` 开启时有效,控制叠加强度。
*   `_MCIALO` ("Main Color In Ambient Light Only"): **[特色]** MatCap 是否在暗部/环境光下也显示。
    *   如果开启,MatCap 不受光照方向产生的阴影遮蔽,始终发亮。适合金属、丝绸等高反射材质。

### Implementation (实现原理)

`RT_MCAP` 和 `RT_MCAP_SUB1` 函数 (`RT_URP_Core.hlsl`)。

```glsl
// 1. 采样 MatCap
half3 RT_MCAP(float2 uv, float3 normalDirection)
{
    // View Space Normal 映射 UV
    half2 MUV = (mul(UNITY_MATRIX_V, float4(normalDirection, 0.0)).xyz.rgb.rg * 0.5 + 0.5);
    half4 _MatCap_var = SAMPLE_TEXTURE2D(_MCap, sampler_MCap, TRANSFORM_TEX(MUV, _MCap));
    
    // 应用遮罩和强度
    // 这里代码逻辑有点绕,似乎还涉及 _SPECMODE 对输出的影响
    float3 MCapOutP = lerp(RT_SPECMO_OO, lerp(RT_SPECMO_OO, _MatCap_var.rgb, _MCapIntensity), _MCapMask_var.rgb);
    return MCapOutP;
}

// 2. 混合到主颜色 (RT_MCAP_SUB1)
half3 RT_MCAP_SUB1(half3 MCapOutP, half4 _MainTex_var, ...)
{
    // 如果 _SPECMODE 开启 (Add模式)
    // RT_SPECMO_OO = (_MainColor * _MaiColPo) + (MCapOutP * _SPECIN); // 叠加公式
    
    // 如果 _SPECMODE 关闭 (Mix模式)
    // RT_SPECMO_OO = (_MainColor * _MaiColPo) * MCapOutP; // 乘法公式
    
    // 最终输出 RTD_TEX_COL
    return RTD_TEX_COL;
}
```

---

## 2. Reflection (反射)

RToon 支持两种反射模式:标准 PBR 反射和伪造反射 (FReflection)。

### A. FReflection (Fake/Fast Reflection)
一种极低成本的风格化反射,不采样 Reflection Probe,而是直接将一张贴图映射到反射向量上。

*   **Properties**:
    *   `_FReflection` ("FReflection", 2D): 反射贴图(通常是全景图或环境图)。
    *   `_ReflectionIntensity`: 反射强度。
    *   `_ReflectionRoughtness`: 模糊度(采样 LOD)。
    *   `_MaskReflection`: 遮罩。

*   **Implementation**:
    ```glsl
    // 计算视线反射向量
    half2 ref_cal = reflect(viewDirection, normalDirection).rg;
    // 映射到 UV (球面映射近似)
    half2 ref_cal_out = (float2(ref_cal.r, (-1.0 * ref_cal.g)) * 0.5 + 0.5);
    // 采样贴图
    half4 _FReflection_var = SAMPLE_TEXTURE2D_LOD(_FReflection, sampler_FReflection, TRANSFORM_TEX(ref_cal_out, _FReflection), _ReflectionRoughtness);
    ```
*   **优点**: 无论场景如何,角色反射始终一致(适合动漫角色的固定画风),且性能极高。

### B. Standard Reflection
*   调用 `GlossyEnvironmentReflection`,采样 Unity 的 Reflection Probe。
*   受 `_RefMetallic` 控制。

---

## 3. Analysis (分析)

*   **二次元金属感**: 推荐使用 `_MCap` + `_MCIALO` (On) + `_SPECMODE` (On)。这样金属部分会有强烈的高光,且不受阴影影响,始终保持闪亮。
*   **固定风格**: `FReflection` 是非常实用的功能。二次元游戏往往希望角色身上的反射是受控的(比如永远反射蓝天白云),而不是反射真实的灰暗场景。
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