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/PoiyomiShaders/Details/03_Surface_Reflections.md

View on GitHub
# Surface & Reflections

Poiyomi Shader offers a layered approach to surface properties, allowing mixing of stylized (MatCap, Toon Rim) and realistic (PBR, Cubemap) effects.

## 1. Reflections & Specular
The shader supports a standard PBR workflow as well as stylized specular.

### PBR (Mochie BRDF)
*   **Properties**:
    *   **`_MochieMetallicMultiplier`**: Global metallic value.
    *   **`_MochieRoughnessMultiplier`**: Global smoothness/roughness.
    *   **`_MochieMetallicMaps`**: Packed map (Metallic, Roughness, Occlusion).
*   **Implementation**: Calculates standard Unity PBR or a modified BRDF.
*   **GSAA (`_MochieGSAAEnabled`)**: Geometric Specular Aliasing Approximation. Reduces shimmering on high-frequency normal maps by adjusting roughness based on screen-space derivatives.

### Stylized Specular
*   **Multi-Layer**: Support for primary and secondary specular highlights.
*   **Masking**: High granular control over where highlights appear.
*   **Toon Ramp**: Specular falloff can be controlled via a ramp for hard-edged anime highlights.

## 2. MatCap (Material Capture)
Poiyomi allows up to **4 MatCap layers** (0-3).

### Properties
*   **`_Matcap`**: The MatCap texture (sphere map).
*   **`_MatcapColor`**: Tint color.
*   **`_MatcapBorder`**: Controls the edge falloff/size of the MatCap.
*   **`_MatcapBlendMode`**: Selects the blending equation (0=Add, 1=Replace, etc.).
*   **`_MatcapMask`**: Texture to mask the effect.

### Implementation
**Call Site**: `applyMatcap` function (called in `frag` approx line 12417).

**Logic (Pseudo-code):**
```hlsl
// 1. Calculate MatCap UVs based on View-Space Normals
float3 worldViewUp = normalize(float3(0, 1, 0) - viewDir * dot(viewDir, float3(0, 1, 0)));
float3 worldViewRight = normalize(cross(viewDir, worldViewUp));
float2 matcapUV = float2(dot(worldViewRight, normal), dot(worldViewUp, normal)) * _MatcapBorder + 0.5;

// 2. Sample Texture
float4 matcapColor = tex2D(_Matcap, matcapUV) * _MatcapColor;

// 3. Apply Masking
matcapColor *= tex2D(_MatcapMask, uv);

// 4. Blending (Simplified)
switch(_MatcapBlendMode) {
    case REPLACE:  baseColor = lerp(baseColor, matcapColor, mask); break;
    case ADD:      baseColor += matcapColor * mask; break;
    case MULTIPLY: baseColor *= matcapColor * mask; break;
    case SCREEN:   baseColor = 1 - (1 - baseColor) * (1 - matcapColor * mask); break;
}
```

## 3. Rim Lighting
Three distinct Rim Lighting styles are supported:

### 1. Poiyomi Style (`_RIMSTYLE_POIYOMI`)
Standard rim light based on NdotV.
*   **Properties**: `_RimWidth`, `_RimSharpness`, `_RimPower`, `_RimLightColor`.
*   **Logic**:
    ```hlsl
    // Fresnel-like calculation
    float rim = 1.0 - saturate(dot(viewDir, normal));
    // Sharpening
    rim = smoothstep(_RimWidth, _RimWidth + _RimSharpness, rim);
    rim = pow(rim, _RimPower);
    ```

### 2. UTS2 Style (`_RIMSTYLE_UTS2`)
Emulates Unity-Chan Toon Shader. Blends rim light based on light direction (Antipodean Rim).
*   **Feature**: `_Add_Antipodean_RimLight` adds a second rim opposite to the light.

### 3. lilToon Style (`_RIMSTYLE_LILTOON`)
Emulates lilToon rim lighting.
*   **Backface Mask**: `_RimBackfaceMask` prevents rim light on backfaces.
*   **Indirection**: Includes logic for indirect light contribution.

**Depth Rim**: A special rim light calculated based on scene depth, useful for highlighting edges intersecting with other geometry (e.g., force fields).

## 4. CubeMap
Environment reflections using a Unity CubeMap.
*   **Properties**: `_CubeMap`, `_CubeMapIntensity`, `_CubeMapRotation`.
*   **Logic**: Samples the CubeMap using the reflection vector (`reflect(-viewDir, normal)`).

## 5. Anisotropy
Simulates hair-like highlights.
*   **Properties**: `_AnisoColorMap`, `_Aniso0Strength`, `_Aniso0Offset`.
*   **Tangent Space**: Uses `dot(tangent, halfDir)` instead of `dot(normal, halfDir)` for highlight calculation.
*   **Bi-Directional**: Can have highlights in two directions (e.g., hair strand sheen).
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: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated 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: 323kUpdated Claude CodeCodexVerifiedInstall