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/UnityChanToonShaderVer2/Details/01_DoubleShade.md

View on GitHub
# Double Shade with Feather

This is the standard shading mode of UTS2. It simulates the anime production workflow where colors are defined as "Base", "1st Shadow", and "2nd Shadow".

## 1. The Three Layers
The final color is a composition of three distinct states based on lighting intensity:

1.  **Base Color**: The fully lit area.
    *   **Properties**: `_BaseColor` (Tint), `_MainTex` (Texture).
    *   **Condition**: High light intensity (NdotL > Threshold).
2.  **1st Shade**: The primary shadow.
    *   **Properties**: `_1st_ShadeColor`, `_1st_ShadeMap`.
    *   **Condition**: Medium light intensity.
3.  **2nd Shade**: The darkest shadow (often used for occlusion or deep folds).
    *   **Properties**: `_2nd_ShadeColor`, `_2nd_ShadeMap`.
    *   **Condition**: Low light intensity.

## 2. Feathering & Steps
UTS2 uses a "Step" and "Feather" system to control the transition between these layers.

### Properties
*   **`_BaseColor_Step`**: The light threshold (0-1) where Base Color transitions to 1st Shade.
*   **`_BaseShade_Feather`**: The softness of this edge.
    *   `0.0001`: Sharp Anime Edge.
    *   `1.0`: Smooth Soft Shading.
*   **`_ShadeColor_Step`**: The threshold between 1st Shade and 2nd Shade.
*   **`_1st2nd_Shades_Feather`**: The softness of the 2nd shade transition.

## 3. Position Maps (Fixed Shadows)
To ensure characters look perfect (e.g., preventing ugly nose shadows), UTS2 allows fixing shadows to specific areas regardless of light direction.

*   **`_Set_1st_ShadePosition`**: 1st Shade Fix Map.
*   **`_Set_2nd_ShadePosition`**: 2nd Shade Fix Map.
*   **Principle**: These maps modify the *threshold* of the shading calculation. A black pixel in this map forces the shader to think the light intensity is lower than it actually is.

### Implementation Logic (Pseudo-Code)
The shader combines the dynamic NdotL (HalfLambert) with the static Position Map to calculate a mask.

**Call Site**: `fragDoubleShadeFeather` in `UniversalToonBodyDoubleShadeWithFeather.hlsl`.

```hlsl
// 1. Calculate Basic Light Response (Half Lambert)
// Ranges from 0 (Dark) to 1 (Lit)
float HalfLambert = 0.5 * dot(normal, lightDir) + 0.5;

// 2. Sample Position Map
// 1.0 (White) = Normal lighting behavior
// 0.0 (Black) = Force Shadow
float PosMap1 = tex2D(_Set_1st_ShadePosition, uv).r;

// 3. Calculate 1st Shade Mask
// This formula maps the Light Level and Position Map into a 0-1 mask
// based on the Step and Feather settings.
float shadowMask1 = saturate(
    (1.0 + ( (HalfLambert - (_BaseColor_Step - _BaseShade_Feather)) 
    * ((1.0 - PosMap1) - 1.0) ) 
    / (_BaseColor_Step - (_BaseColor_Step - _BaseShade_Feather)))
);

// 4. Calculate 2nd Shade Mask (Similar logic)
float PosMap2 = tex2D(_Set_2nd_ShadePosition, uv).r;
float shadowMask2 = saturate(
    (1.0 + ( (HalfLambert - (_ShadeColor_Step - _1st2nd_Shades_Feather)) 
    * ((1.0 - PosMap2) - 1.0) ) 
    / (_ShadeColor_Step - (_ShadeColor_Step - _1st2nd_Shades_Feather)))
);

// 5. Combine Layers
// If shadowMask1 is 1.0, we see Base Color. If 0.0, we see Shade.
float3 ColorWith1st = lerp(_1st_ShadeColor, _BaseColor, shadowMask1);
float3 FinalColor = lerp(_2nd_ShadeColor, ColorWith1st, shadowMask2);
```

## 4. System Shadows
UTS2 integrates with Unity's shadow system (Cast Shadows/Receive Shadows).
*   **`_Set_SystemShadowsToBase`**: Controls how much the received shadows (from other objects) affect the toon shading.
*   **`_Tweak_SystemShadowsLevel`**: Fine-tunes the intensity of received shadows.
*   **Implementation**: The `HalfLambert` value is multiplied by the system shadow attenuation (`shadowAttenuation`) before the mask calculation, effectively treating cast shadows as "darker light".
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