skills/ue-shader-complexity-report/SKILL.md
Profile material shader complexity including instruction counts, texture samples, and GPU cost estimation. Identify expensive shaders and suggest LOD variants. Use when optimizing rendering, debugging GPU bottlenecks, or auditing material performance. Triggers on "shader complexity", "material performance", "GPU optimization", "instruction count", "shader profiling", "material cost".
npx skillsauth add sipherxyz/universal-ue-skills ue-shader-complexity-reportInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Profile material shader complexity and identify optimization targets.
| Platform | VS Budget | PS Budget | Notes | |----------|-----------|-----------|-------| | PC High | 500 | 500 | Desktop GPUs | | PC Medium | 300 | 300 | Mid-range | | PS5 | 400 | 400 | Fixed hardware | | Xbox Series X | 400 | 400 | Fixed hardware | | Xbox Series S | 250 | 250 | Lower power |
| Quality Level | Max Samples | Notes | |---------------|-------------|-------| | High | 16 | Desktop/Next-gen | | Medium | 12 | Consoles | | Low | 8 | Performance mode |
# Console commands
stat ShaderComplexity # Enable complexity view
r.ShaderComplexityColors 1 # Color-coded visualization
ProfileGPU # GPU profiler
stat GPU # GPU frame stats
## Material Analysis: M_{MaterialName}
### Shader Statistics
| Metric | Base Pass | Depth | Velocity |
|--------|-----------|-------|----------|
| VS Instructions | {N} | {N} | {N} |
| PS Instructions | {N} | {N} | {N} |
| Texture Samples | {N} | {N} | {N} |
| Interpolators | {N} | {N} | {N} |
### Compilation Info
| Variant | Compiled | Instructions |
|---------|----------|--------------|
| Default | Yes | {N} |
| Static Lighting | Yes | {N} |
| Dynamic Lighting | Yes | {N} |
| Masked | Yes | {N} |
### Expensive Operations Detected
#### Texture Samples
| Sample | Type | Cost | Suggestion |
|--------|------|------|------------|
| Diffuse | Texture2D | Low | OK |
| Normal | Texture2D | Low | OK |
| DetailNormal | Texture2D | Medium | Consider merging |
| Noise1 | Texture2D | Medium | Use world-space tiling |
| Noise2 | Texture2D | Medium | Combine with Noise1 |
#### Math Operations
| Operation | Count | Cost | Suggestion |
|-----------|-------|------|------------|
| Sine | 5 | High | Use LUT or approximate |
| Power | 8 | Medium | Reduce or precompute |
| Normalize | 12 | Low | OK |
| Dot | 15 | Low | OK |
#### Special Features
| Feature | Cost | Impact |
|---------|------|--------|
| Subsurface Scattering | High | +100 instructions |
| Refraction | High | Extra pass |
| Masked | Medium | Early-Z rejection |
### LOD Material Strategy
| LOD Level | Distance | Recommendations |
|-----------|----------|-----------------|
| LOD0 | 0-1000 | Full material (current) |
| LOD1 | 1000-3000 | Remove detail normal, reduce samples |
| LOD2 | 3000-5000 | Simplified shader, 4 samples max |
| LOD3 | 5000+ | Flat color or impostor |
### Simplified Material Variants
#### M_{MaterialName}_LOD1
- Remove: Detail normal, noise
- Keep: Diffuse, main normal
- Savings: ~30% instructions
#### M_{MaterialName}_LOD2
- Remove: All secondary textures
- Keep: Diffuse only
- Savings: ~60% instructions
Before: 12 samples
- Diffuse (1)
- Normal (1)
- Roughness (1)
- Metallic (1)
- AO (1)
- Detail Diffuse (1)
- Detail Normal (1)
- Noise x3 (3)
- Mask x2 (2)
After: 6 samples
- Diffuse (1)
- Normal (1)
- ORM packed (1) - Occlusion/Roughness/Metallic
- Detail Normal (1) - Merged detail
- Noise (1) - Single 4-channel noise
- Mask (1) - Combined masks
Savings: 50% texture samples
// EXPENSIVE: Sine wave animation
float Wave = sin(Time * Frequency);
// CHEAPER: Triangle wave approximation
float Wave = abs(frac(Time * Frequency) * 2 - 1) * 2 - 1;
// CHEAPEST: LUT texture
float Wave = Texture2DSample(WaveLUT, Time * Frequency).r;
### Material Instance Strategy
Base Material: M_Character_Master
├── Exposes all parameters
├── Static switches for features
└── Compiles all variants
Instances for common cases:
├── MI_Character_Simple (no subsurface)
├── MI_Character_Full (all features)
└── MI_Character_Background (LOD2 equivalent)
Benefit: Pre-compiled permutations, no runtime branching
# Shader Complexity Report
## Executive Summary
- **Scope**: {Scope}
- **Materials Analyzed**: {N}
- **Over Budget**: {N}
- **Critical**: {N}
## Top Offenders
| Material | PS Instructions | Samples | Status |
|----------|-----------------|---------|--------|
| M_{Name} | {N} | {N} | Over |
| M_{Name} | {N} | {N} | Over |
## Budget Compliance
| Budget | Pass | Warning | Fail |
|--------|------|---------|------|
| Instructions | {N} | {N} | {N} |
| Samples | {N} | {N} | {N} |
## Optimization Opportunities
| Material | Current | Target | Savings |
|----------|---------|--------|---------|
| M_{Name} | {N} inst | {N} inst | {N}% |
## Recommendations
1. {Recommendation with expected GPU time savings}
## Scene Impact
- Current GPU material cost: {N}ms
- After optimization: {N}ms estimated
- Savings: {N}%
| Command | Purpose |
|---------|---------|
| viewmode ShaderComplexity | Complexity visualization |
| r.ShaderComplexityColors | Toggle color coding |
| stat Material | Material statistics |
| DumpShaderStats | Export shader stats |
| r.DumpShaderDebugInfo | Debug shader compilation |
development
This skill should be used when implementing features in isolation using git worktrees. Triggers on "create worktree", "isolated workspace", "parallel development", or when starting implementation that should not affect main workspace.
testing
Manage VFX team issues on GitHub Projects - timeline scheduling, status updates, member commit checks, bulk assign. Use when managing VFX team project board, adding issues to timeline, checking member progress, or bulk-updating issue fields.
tools
Generate C++ validation rules from JSON definitions. Use when team updates ValidationRules.json or asks to add/modify validation rules.
development
Check codebase for Microsoft Xbox XR (Xbox Requirements) compliance issues. Scans for account picker, cloud saves, achievements, Quick Resume, and Xbox certification requirements. Use before console submission or when preparing for Microsoft certification. Triggers on "XR", "Xbox certification", "Microsoft compliance", "Xbox cert", "Xbox requirements", "GDK compliance".