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/06_Advanced_Features.md

View on GitHub
# Advanced Features (高级功能)

RToon 在 V5 版本中引入了一些针对现代 Unity 渲染管线的高级特性。

## 1. DOTS & GPU Skinning (ECS 支持)

RToon 显式支持 Unity 的 DOTS (Data-Oriented Technology Stack) 实例化和蒙皮,这在第三方 Toon Shader 中比较少见。

### Implementation Logic
在 `D_Default_URP.shader` 和 `RT_URP_Core.hlsl` 中:

```glsl
// 宏定义检查
#if defined(UNITY_DOTS_INSTANCING_ENABLED)
    // 定义 DOTS 所需的属性 (Weights, Indices)
    float4 weights : BLENDWEIGHTS;
    uint4 indices : BLENDINDICES;
#endif

// 顶点变换函数 (DOTS_LiBleSki)
void DOTS_LiBleSki(uint4 indices, float4 weights, float3 positionIn, float3 normalIn, float3 tangentIn, out float3 positionOut, out float3 normalOut, out float3 tangentOut)
{
    // 从 StructuredBuffer 读取骨骼矩阵
    // _SkinMatrices 是全局计算缓冲区
    for (int i = 0; i < 4; ++i)
    {
        float3x4 skinMatrix = _SkinMatrices[indices[i] + asint(UNITY_ACCESS_HYBRID_INSTANCED_PROP(_SkinMatrixIndex, float))];
        // ... 矩阵变换 ...
        positionOut += vtransformed * weights[i];
        // ...
    }
}
```
*   **意义**: 允许在大规模战斗场景中渲染成千上万个带动画的卡通角色,且保持高性能(GPU Skinning + Instancing)。

## 2. Triplanar Mapping (三向贴图)

通过开启 `N_F_TP_ON` 宏,所有主要贴图(MainTex, ShadowT, Mask, etc.)的采样方式会从 UV 采样变为 Triplanar 采样。

### Implementation
```glsl
half4 RT_Tripl_Default(TEXTURE2D_PARAM(tex, samp), float3 positionWS, float3 normalWS)
{
    float3 UV = positionWS * _TriPlaTile; // 世界坐标作为 UV
    float3 Blend = pow(abs(normalWS), _TriPlaBlend); // 基于法线计算混合权重
    Blend /= dot(Blend, 1.0); // 归一化
    
    // 三次采样
    float4 X = SAMPLE_TEXTURE2D_LOD(tex, samp, UV.zy, 0.0);
    float4 Y = SAMPLE_TEXTURE2D_LOD(tex, samp, UV.xz, 0.0);
    float4 Z = SAMPLE_TEXTURE2D_LOD(tex, samp, UV.xy, 0.0);

    return X * Blend.x + Y * Blend.y + Z * Blend.z;
}
```
*   **用途**: 适用于地形、甚至不需要展 UV 的程序化场景物体。但在角色渲染中较少使用(因为 UV 更好控制),除非是像史莱ム或元素生物这样的无定形物体。

## 3. Near Fade Dithering (近距离抖动消隐)

防止摄像机穿模时看到模型内部。当相机非常靠近物体时,使用 Dither Pattern 逐渐透明化物体。

### Properties
*   `_MinFadDistance`: 开始消隐的距离。
*   `_MaxFadDistance`: 完全消失的距离。

### Implementation (RT_NFD)
```glsl
void RT_NFD(float2 positionCS)
{
    float distanceFromCamera = distance(...);
    // 比较 Dither 矩阵值和距离系数
    clip(-(RT_Dither_Out(positionCS) - saturate((distanceFromCamera - _MinFadDistance) / _MaxFadDistance)));
}
```
*   **原理**: 利用 4x4 的 Bayer Dither 矩阵 (`RT_Dither_Out`) 生成有序噪点,在 clip 阶段丢弃像素。

## 4. Cutout Glow (辉光边缘)

为 Cutout (Alpha Test) 材质的边缘增加发光效果。

### Implementation
```glsl
// 计算边缘区域
half _Glow_Edge_Width_Add_Input_Value = ((1.0 - _Glow_Edge_Width) + RTD_CO); // RTD_CO 是 Alpha 值
// ... Remapping ...
half3 _Final_Output = (_Pre_Output * lerp(0.0, _Glow_Color.rgb, saturate(_Cutout * 200.0)));
```
*   **用途**: 科技感全息投影、被烧毁的纸张边缘、能量护盾等。
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 CodeCodexUnverifiedInstall
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