graphics-rendering について
ゲームのグラフィックスとレンダリングに取り組む開発者向けの資料です。シェーダー例、視覚効果、最適化、プラットフォーム別の指針を扱います。
主な機能
- 01レンダリングパイプラインの概要
- 02PBRおよびトゥーンシェーダーの例
- 03パーティクルシステムの構成
- 04バッチング、インスタンシング、LOD、カリング技術
- 05プラットフォーム別のレンダリング指針
活用シーン
- 01ゲームマテリアル用シェーダーの作成
- 02パーティクルを使った視覚効果の制作
- 03ゲームシーンのドローコール削減
- 04プラットフォームに応じたレンダリング設定の選択
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ pluginagentmarketplace/ custom-plugin-game-developer --skill graphics-renderingインストール後、Claude Code で/graphics-renderingを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
assets/rendering_config.yamlreferences/RENDERING_GUIDE.mdscripts/render_analyzer.py詳細
グラフィックスとレンダリング
レンダリングパイプライン
┌─────────────────────────────────────────────────────────────┐
│ RENDERING PIPELINE │
├─────────────────────────────────────────────────────────────┤
│ VERTEX STAGE: │
│ Model Space → World Space → View Space → Clip Space │
│ ↓ │
│ RASTERIZATION: Triangles → Fragments │
│ ↓ │
│ FRAGMENT STAGE: Color, Lighting, Texturing │
│ ↓ │
│ OUTPUT: Final pixel color to framebuffer │
└─────────────────────────────────────────────────────────────┘
シェーダープログラミング
標準 PBR シェーダー(HLSL)
// ✅ Production-Ready: PBR Surface Shader
struct SurfaceData
{
float3 Albedo;
float3 Normal;
float Metallic;
float Roughness;
float AO;
};
float3 FresnelSchlick(float cosTheta, float3 F0)
{
return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0);
}
float DistributionGGX(float3 N, float3 H, float roughness)
{
float a = roughness * roughness;
float a2 = a * a;
float NdotH = max(dot(N, H), 0.0);
float NdotH2 = NdotH * NdotH;
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
return a2 / (PI * denom * denom);
}
float4 PBRLighting(SurfaceData surface, float3 viewDir, float3 lightDir)
{
float3 H = normalize(viewDir + lightDir);
float3 F0 = lerp(0.04, surface.Albedo, surface.Metallic);
float D = DistributionGGX(surface.Normal, H, surface.Roughness);
float3 F = FresnelSchlick(max(dot(H, viewDir), 0.0), F0);
float3 diffuse = surface.Albedo * (1.0 - surface.Metallic);
float3 specular = D * F;
return float4((diffuse + specular) * surface.AO, 1.0);
}
トゥーン/セルシェーダー
// ✅ Production-Ready: Toon Shader
float4 ToonShading(float3 normal, float3 lightDir, float4 baseColor)
{
float NdotL = dot(normal, lightDir);
// Step function for cel shading
float toonRamp;
if (NdotL > 0.7) toonRamp = 1.0;
else if (NdotL > 0.3) toonRamp = 0.6;
else if (NdotL > 0.0) toonRamp = 0.3;
else toonRamp = 0.1;
return baseColor * toonRamp;
}
// Outline pass (inverted hull method)
float4 OutlineVertex(float4 position, float3 normal, float outlineWidth)
{
position.xyz += normal * outlineWidth;
return position;
}
視覚効果(VFX)
パーティクルシステムの設定
PARTICLE SYSTEM ARCHITECTURE:
┌─────────────────────────────────────────────────────────────┐
│ EMITTER: Rate, Bursts, Shape │
│ ↓ │
│ SPAWN: Initial velocity, Size, Color, Lifetime │
│ ↓ │
│ UPDATE: Forces, Collisions, Color over life │
│ ↓ │
│ RENDER: Billboard, Mesh, Trail │
└─────────────────────────────────────────────────────────────┘
COMMON VFX RECIPES:
┌────────────────┬────────────────────────────────────────────┐
│ Fire │ Orange→Yellow gradient, upward velocity │
│ Smoke │ Gray billboards, turbulence noise │
│ Sparks │ Point emitter, gravity, short lifetime │
│ Magic │ Spiral path, glow, color cycling │
│ Blood │ Burst, gravity, decal on collision │
└────────────────┴────────────────────────────────────────────┘
最適化手法
| 手法 | ドローコールの削減率 | 使用するタイミング |
|---|---|---|
| 静的バッチング | 90% 以上 | 静的なジオメトリ |
| 動的バッチング | 50~80% | 小さく移動するオブジェクト |
| GPU インスタンシング | 95% 以上 | 同一のオブジェクトが多数ある場合 |
| LOD システム | 40~60% | 遠くにあるオブジェクト |
| オクルージョンカリング | 30~70% | 屋内シーン |
LOD の設定
LOD DISTANCE SETUP:
┌─────────────────────────────────────────────────────────────┐
│ LOD0 (100% tris): 0-20m → Full detail │
│ LOD1 (50% tris): 20-50m → Reduced detail │
│ LOD2 (25% tris): 50-100m → Low detail │
│ LOD3 (10% tris): 100m+ → Billboard/Impostor │
└─────────────────────────────────────────────────────────────┘
🔧 トラブルシューティング
┌─────────────────────────────────────────────────────────────┐
│ PROBLEM: Too many draw calls (>2000) │
├─────────────────────────────────────────────────────────────┤
│ SOLUTIONS: │
│ → Enable GPU instancing for repeated objects │
│ → Use texture atlases │
│ → Merge static meshes │
│ → Implement LOD system │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ PROBLEM: Shader artifacts / visual glitches │
├─────────────────────────────────────────────────────────────┤
│ SOLUTIONS: │
│ → Check for division by zero │
│ → Validate normal vectors │
│ → Use saturate() on color outputs │
│ → Check texture sampling modes │
└─────────────────────────────────────────────────────────────┘
プラットフォーム別ガイドライン
| プラットフォーム | ドローコールの上限 | シェーダーの複雑さ | テクスチャサイズ |
|---|---|---|---|
| モバイル | 100~200 | 低 | 最大 1024px |
| コンソール | 2000~3000 | 高 | 4096px |
| PC | 3000~5000 | 非常に高 | 8192px |
| VR | 100~150 | 低 | 2048px |
このスキルを使う場面:シェーダーの作成、ビジュアルの最適化、またはエフェクトの実装時。
コメント
Markdown 対応