Forge Environment Mappingのロゴ

Forge Environment Mapping

コミュニティ
Nebulavenus
forge-environment-mapping

Add cube map environment mapping with a skybox and reflective surfaces. Use when someone needs a 360-degree background, reflection mapping, or cube map textures in SDL3 GPU.

概要

公開者Nebulavenus
リポジトリforge-gpu
スキル名forge-environment-mapping
スター
46
フォーク
7
同梱ファイル
指示のみ
ライセンスZlib
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

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

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

Environment Mapping — SDL3 GPU Skill

Add a cube map skybox and environment reflections to a 3D scene.

When to use this skill

  • Rendering a 360-degree background (space, sky, indoor environment)
  • Adding reflections to metallic or glossy surfaces
  • Working with SDL_GPU_TEXTURETYPE_CUBE textures
  • Combining multiple graphics pipelines in one render pass

Cube map texture creation

c
/* Create a cube map texture with 6 faces. */
SDL_GPUTextureCreateInfo tex_info;
SDL_zero(tex_info);
tex_info.type                 = SDL_GPU_TEXTURETYPE_CUBE;
tex_info.format               = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB;
tex_info.usage                = SDL_GPU_TEXTUREUSAGE_SAMPLER;
tex_info.width                = face_size;
tex_info.height               = face_size;
tex_info.layer_count_or_depth = 6;  /* MUST be 6 for cube maps */
tex_info.num_levels           = 1;

SDL_GPUTexture *cubemap = SDL_CreateGPUTexture(device, &tex_info);

/* Upload each face as a separate layer (0=+X, 1=-X, 2=+Y, 3=-Y, 4=+Z, 5=-Z). */
for (int face = 0; face < 6; face++) {
    /* Load face image, convert to ABGR8888, map transfer buffer... */

    SDL_GPUTextureRegion dst;
    SDL_zero(dst);
    dst.texture = cubemap;
    dst.layer   = (Uint32)face;  /* Face index = layer index */
    dst.w       = face_size;
    dst.h       = face_size;
    dst.d       = 1;

    SDL_UploadToGPUTexture(copy_pass, &src, &dst, false);
}

Skybox rendering pattern

Vertex shader — depth = 1.0

hlsl
cbuffer VertUniforms : register(b0, space1)
{
    column_major float4x4 vp_no_translation;
};

struct VSOutput
{
    float4 clip_pos  : SV_Position;
    float3 direction : TEXCOORD0;
};

VSOutput main(VSInput input)
{
    VSOutput output;
    output.direction = input.position;

    float4 pos = mul(vp_no_translation, float4(input.position, 1.0));
    output.clip_pos = pos.xyww;  /* z = w → depth = 1.0 after divide */

    return output;
}

Fragment shader — sample cube map

hlsl
TextureCube  skybox_tex : register(t0, space2);
SamplerState smp        : register(s0, space2);

float4 main(PSInput input) : SV_Target
{
    return skybox_tex.Sample(smp, input.direction);
}

Pipeline settings

c
/* Cull FRONT faces — we're inside the cube. */
pipe_info.rasterizer_state.cull_mode = SDL_GPU_CULLMODE_FRONT;

/* Depth test LESS_OR_EQUAL to pass at depth=1.0.
 * Depth write DISABLED — skybox should never occlude anything. */
pipe_info.depth_stencil_state.enable_depth_test  = true;
pipe_info.depth_stencil_state.enable_depth_write = false;
pipe_info.depth_stencil_state.compare_op = SDL_GPU_COMPAREOP_LESS_OR_EQUAL;

Rotation-only view matrix

c
/* Strip translation so the skybox always surrounds the camera. */
mat4 view_rot = view;
view_rot.m[12] = 0.0f;
view_rot.m[13] = 0.0f;
view_rot.m[14] = 0.0f;
mat4 vp_sky = mat4_multiply(proj, view_rot);

Reflection mapping pattern

Fragment shader with reflections

hlsl
TextureCube env_tex : register(t1, space2);

/* Compute reflection direction */
float3 V = normalize(eye_pos.xyz - world_pos);
float3 R = reflect(-V, N);
float3 env_color = env_tex.Sample(env_smp, R).rgb;

/* Blend diffuse with environment reflection */
float3 blended = lerp(surface_color.rgb, env_color, reflectivity);

Render order

  1. Clear depth to 1.0
  2. Draw skybox (depth write off, passes at depth=1.0)
  3. Draw objects (depth write on, depth < 1.0 always passes)

Common mistakes

  1. Forgetting layer_count_or_depth = 6 — cube maps require exactly 6 layers. Without this, texture creation fails silently or renders black.

  2. Wrong face order — SDL_GPUCubeMapFace enum order is +X, -X, +Y, -Y, +Z, -Z. Mixing up faces produces seams or incorrect reflections.

  3. Depth write enabled on skybox — the skybox writes depth=1.0 everywhere, occluding all subsequent geometry. Always disable depth write for the skybox.

  4. Using full view matrix for skybox — includes camera translation, causing visible parallax when moving. Strip translation columns (m[12], m[13], m[14]).

  5. Wrong cull mode for skybox — the camera is inside the cube, so front faces point inward (toward the camera). Cull front faces, not back faces.

  6. Not negating V in reflect() — reflect() expects the incident vector pointing toward the surface. The view direction V points away from the surface, so pass -V.

File layout

text
shaders/
├── skybox.vert.hlsl      # Unit cube → clip space with depth=1.0
├── skybox.frag.hlsl      # Sample TextureCube
├── object.vert.hlsl      # Standard MVP + model (same as lighting)
└── object.frag.hlsl      # Blinn-Phong + reflect() + cube map sample

References

よくある質問

AIスキル「Forge Environment Mapping」では何ができますか?

Add cube map environment mapping with a skybox and reflective surfaces. Use when someone needs a 360-degree background, reflection mapping, or cube map textures in SDL3 GPU.

TypingMindでForge Environment Mappingを使うメリットは何ですか?

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

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

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-environment-mappingを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Forge Environment Mappingを使えるAIモデルはどれですか?

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

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

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

AIスキル「Forge Environment Mapping」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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