Procedural Artのロゴ

Procedural Art

コミュニティ
danicat
procedural-art

Pure-code procedural graphics, sprite generation, and visual effects (VFX) guide for 2D games. Generates sprites, tilesets, particle systems, and vector shapes in memory without external image files, enforcing 2D matrix transformation order, sub-frame animation easing, and pre-allocated particle pools. Activate when creating procedural 2D sprites, building zero-asset games, designing particle effects, or implementing 2D matrix transformations.

概要

公開者danicat
リポジトリskills
スキル名procedural-art
スター
24
フォーク
4
同梱ファイル
2
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    danicatがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Procedural Art」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/danicat/skills/tree/main/game-dev/procedural-art
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/danicat/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/game-dev/procedural-art .claude/skills/procedural-art
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでProcedural Artを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にProcedural Artを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Procedural Artは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Procedural Art: Pure-Code 2D Sprites, SDF Primitives, Material Ramps & VFX Guide

This skill provides mathematical, graphical, and software architecture patterns for generating high-quality 2D sprites, tilesets, Signed Distance Field (SDF) shapes, particle systems, and visual effects (VFX) purely in code—without relying on external .png, .jpg, or .svg asset files.

[!TIP] Reference Implementation:


1. Core Architectural Principles & Zero-Asset Strategy

Procedural art generates graphical textures in memory at startup (Boot state) or renders vector/particle effects dynamically during game frames:

  • Zero Disk I/O: Eliminates asset loading delays, missing file errors, and external bundle dependencies.
  • Signed Distance Field (SDF) Rasterization: Composes organic characters, weapons, and tiles mathematically using SDFCircle, SDFBox, SDFCapsule, and SDFSmoothMin.
  • Strict Premultiplied Alpha Invariant: Enforces $R, G, B \le A$ on every color.RGBA pixel via PremultiplyRGBA(r, g, b, a).

2. "Retro-HD" Visual Style, Premultiplied Alpha & 4-Step Material Ramps

Target the aesthetic richness of classic 16-bit/32-bit console art (SNES, Sega Saturn, Neo Geo) combined with modern 32-bit truecolor shading.

2.1 Premultiplied Alpha Invariant (PremultiplyRGBA)

In Go's image/color and Ebitengine (image.NewRGBA / ebiten.NewImageFromImage), color.RGBA values are alpha-premultiplied ($R \le A, G \le A, B \le A$). Writing non-premultiplied values like color.RGBA{255, 255, 255, alpha} or color.RGBA{200, 30, 10, 0} causes glowing halos and blending corruption. Always construct translucent colors via PremultiplyRGBA:

go
func PremultiplyRGBA(r, g, b, a uint8) color.RGBA {
	alpha := uint16(a)
	return color.RGBA{
		R: uint8((uint16(r)*alpha + 127) / 255),
		G: uint8((uint16(g)*alpha + 127) / 255),
		B: uint8((uint16(b)*alpha + 127) / 255),
		A: a,
	}
}

2.2 4-Step Material Ramp Structure (MaterialRamp)

Every material in a procedural sprite (steel, crimson, flesh, gold, foliage) uses a structured 4-step shading ramp ([4]color.RGBA) paired with a dark 1-pixel silhouette outline (#0F0C1C):

  1. Step 0 — Deep Shadow ([0]): Primary hue shifted toward cool blue/violet (illumination < 0.25).
  2. Step 1 — Base Tone ([1]): Core saturated material color (0.25 <= illumination < 0.65).
  3. Step 2 — Light Highlight ([2]): Primary hue shifted toward warm yellow/orange (0.65 <= illumination < 0.90).
  4. Step 3 — High Specular ([3]): Crisp specular edge or rim highlight (illumination >= 0.90).

3. 2D Signed Distance Field (SDF) Primitives & Smooth Blending

Instead of drawing blocky raw rectangles, sculpt multi-part sprites at startup by evaluating 2D Signed Distance Fields per pixel $(p_x, p_y)$ and blending limbs/armor plates with polynomial smooth minimum (SDFSmoothMin):

  • Circle (SDFCircle): $d = |(p_x - c_x, p_y - c_y)|_2 - r$
  • Rounded Box (SDFBox): Box centered at $(c_x, c_y)$ with half-extents $(h_w, h_h)$ and corner radius $r$.
  • Line Capsule (SDFCapsule): Swept sphere of radius $r$ along segment $\overline{AB}$ (ideal for limbs, blades, beams, and pauldrons).
  • Smooth Union (SDFSmoothMin): Blends two distance fields $d_1, d_2$ with smoothing factor $k > 0$: $$h = \frac{\max(k - |d_1 - d_2|, 0)}{k}, \quad \text{smin}(d_1, d_2, k) = \min(d_1, d_2) - \frac{1}{4} h^2 k$$

4. Transformation Mathematics & Order of Operations (CRITICAL)

In 2D graphics programming (ebiten.GeoM), matrix multiplication is non-commutative. Applying operations in the wrong order causes sprites to orbit wildly or scale off-screen.

4.1 Exact Sequence: Pivot -> Scale -> Rotate -> World Translation

$$M_{\text{correct}} = T(X + O_x, Y + O_y) \cdot R(\theta) \cdot S(S_x, S_y) \cdot T(-O_x, -O_y)$$

  1. m.Translate(-OriginX, -OriginY) — Move pivot to $(0, 0)$.
  2. m.Scale(ScaleX, ScaleY) — Scale relative to pivot.
  3. m.Rotate(Rotation) — Rotate around pivot.
  4. m.Translate(OriginX+X, OriginY+Y) — Translate to world position.

5. Sub-Frame Interpolation & Non-Linear Easing

Use delta time ($dt$) and non-linear easing functions to model physical weight, momentum, and elasticity:

  • Linear (EaseLinear): $f(t) = t$
  • Ease-In Quadratic (EaseInQuad): $f(t) = t^2$ (accelerating under gravity)
  • Ease-Out Quadratic (EaseOutQuad): $f(t) = t(2 - t)$ (decelerating friction slide)
  • Ease-InOut Cubic (EaseInOutCubic): Smooth S-curve for breathing idle and hover loops
  • Elastic Overshoot (EaseElasticOut): $f(t) = 2^{-10t} \sin\left(\frac{(t - 0.075) \cdot 2\pi}{0.3}\right) + 1$ (springy attacks and UI pop-ups)

6. Retro-HD Sprite Sheet Architecture & Frame Requirements

Animation StateRequired Frames / DirKeyframes & Pose ProgressionEasing / Timing Guidelines
Idle / Breathing4–8 framesSubtle chest rise, shoulder dip, weapon idle shimmer.Smooth EaseInOutCubic (1.2s–1.8s cycle).
Walk / Run Cycle8–12 framesContact $\rightarrow$ Recoil $\rightarrow$ Passing $\rightarrow$ High Point.Continuous loop (0.6s–0.9s cycle).
Attack / Strike6–10 framesWind-up $\rightarrow$ Fast Strike/Impact $\rightarrow$ Follow-through $\rightarrow$ Recovery.Fast EaseInQuad to impact, EaseOutQuad recovery.
Hurt / Hit Recoil3–5 framesSharp backward tilt, hit-flash, recovery.High speed (0.15s–0.25s total).
Death / Collapse6–10 framesStagger $\rightarrow$ Knees buckle $\rightarrow$ Ground impact $\rightarrow$ Settle.Heavy EaseInQuad drop, non-looping final frame.

7. Zero-Allocation Particle Systems & VFX

High-performance visual effects (explosions, thrusters, magic trails, sparks) require both a pre-allocated []Particle pool and a reusable ebiten.DrawImageOptions struct field (ps.drawOp) so Draw() never allocates on the heap:

go
func (ps *ParticleSystem) Draw(screen *ebiten.Image) {
	for i := range ps.pool {
		p := &ps.pool[i]
		if !p.Active {
			continue
		}
		progress := p.Age / p.Life
		size := p.StartSize + progress*(p.EndSize-p.StartSize)
		curColor := LerpColor(p.StartColor, p.EndColor, progress)

		ps.drawOp.GeoM.Reset()
		ps.drawOp.GeoM.Translate(-8, -8)
		ps.drawOp.GeoM.Scale(size, size)
		ps.drawOp.GeoM.Translate(p.X, p.Y)

		ps.drawOp.ColorScale.Reset()
		ps.drawOp.ColorScale.ScaleWithColor(curColor)

		if p.Additive {
			ps.drawOp.Blend = ebiten.BlendLighter
		} else {
			ps.drawOp.Blend = ebiten.BlendSourceOver
		}

		screen.DrawImage(ps.texture, &ps.drawOp)
	}
}

8. Mandatory Quality Directives for AI Art Generation

  1. Premultiplied Alpha Enforcement: Every translucent color.RGBA pixel written to image.RGBA or interpolated in particle systems MUST use PremultiplyRGBA ($R, G, B \le A$).
  2. Zero Allocations in Draw(): Pre-render all procedural *ebiten.Image textures at boot and reuse ebiten.DrawImageOptions (Reset()) inside Draw().
  3. SDF + 4-Step Material Ramp Composition: Combine SDFCircle, SDFBox, SDFCapsule, and SDFSmoothMin with MaterialRamp ([4]color.RGBA) surface normal illumination and 1px dark outlines (ApplyPixelOutline).
  4. Correct Matrix Transformation Order: Always execute Translate(-pivot) -> Scale -> Rotate -> Translate(+pivot + pos).

📚 Progressive Disclosure & References

  • Procedural Art Driver: references/art.go — Premultiplied RGBA helpers, 4-step MaterialRamp shading, SDFCircle/SDFBox/SDFCapsule/SDFSmoothMin primitives, zero-allocation ParticleSystem, and character sprite rasterization.
  • Verification Test Suite: references/art_test.go — Unit tests verifying PremultiplyRGBA, SDF geometry, 4-step material ramps, matrix transformation order, and particle pool lifecycle.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Procedural Art」では何ができますか?

Pure-code procedural graphics, sprite generation, and visual effects (VFX) guide for 2D games. Generates sprites, tilesets, particle systems, and vector shapes in memory without external image files, enforcing 2D matrix transformation order, sub-frame animation easing, and pre-allocated particle pools. Activate when creating procedural 2D sprites, building zero-asset games, designing particle effects, or implementing 2D matrix transformations.

TypingMindでProcedural Artを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Procedural Artはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにProcedural Artをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/danicat/skills/tree/main/game-dev/procedural-artを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Procedural Artを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Procedural Artで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもProcedural Artを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Procedural Art」は無料ですか?

はい。danicatがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇