Forge Scene Renderer logo

Forge Scene Renderer

Community
Nebulavenus
forge-scene-renderer

Set up a complete 3D scene with forge_scene.h — shadow mapping, Blinn-Phong lighting, grid floor, sky gradient, FPS camera, and UI in one init call.

Overview

PublisherNebulavenus
Repositoryforge-gpu
Skill nameforge-scene-renderer
Stars
46
Forks
7
Bundled files
Instructions only
LicenseZlib
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Nebulavenus on GitHub. Read the source before you install it.

Installation

Install the Forge Scene Renderer AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-scene-renderer
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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-scene-renderer .claude/skills/forge-scene-renderer
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Forge Scene Renderer in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Forge Scene Renderer on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Forge Scene Renderer is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

forge-scene-renderer

Set up a complete 3D rendering scene using the forge_scene.h header-only library. One forge_scene_init() call creates the GPU device, window, depth texture, shadow map, six graphics pipelines (shadow, scene, scene double-sided, grid, sky, UI), a quaternion FPS camera, and an optional immediate-mode UI system.

Usage pattern

c
#define SDL_MAIN_USE_CALLBACKS 1
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include "math/forge_math.h"

#define FORGE_SCENE_IMPLEMENTATION
#include "scene/forge_scene.h"

typedef struct {
    ForgeScene scene;
    SDL_GPUBuffer *mesh_vb;
    SDL_GPUBuffer *mesh_ib;
    Uint32 index_count;
} app_state;

SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv)
{
    app_state *state = SDL_calloc(1, sizeof(*state));
    if (!state) return SDL_APP_FAILURE;
    *appstate = state;

    ForgeSceneConfig cfg = forge_scene_default_config("My Scene");
    cfg.cam_start_pos = vec3_create(0.0f, 2.0f, 5.0f);
    cfg.font_path = "assets/fonts/liberation_mono/LiberationMono-Regular.ttf";

    if (!forge_scene_init(&state->scene, &cfg, argc, argv))
        return SDL_APP_FAILURE;

    /* Upload your geometry using forge_scene_upload_buffer.
     * Always check for NULL — upload can fail if the GPU runs out of memory. */
    state->mesh_vb = forge_scene_upload_buffer(&state->scene,
        SDL_GPU_BUFFERUSAGE_VERTEX, vertices, vertex_size);
    state->mesh_ib = forge_scene_upload_buffer(&state->scene,
        SDL_GPU_BUFFERUSAGE_INDEX, indices, index_size);
    if (!state->mesh_vb || !state->mesh_ib) return SDL_APP_FAILURE;

    state->index_count = /* number of indices in your mesh */;

    return SDL_APP_CONTINUE;
}

SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
    return forge_scene_handle_event(&((app_state *)appstate)->scene, event);
}

SDL_AppResult SDL_AppIterate(void *appstate)
{
    app_state *state = appstate;
    ForgeScene *s = &state->scene;

    if (!forge_scene_begin_frame(s)) return SDL_APP_CONTINUE;

    /* Shadow pass */
    forge_scene_begin_shadow_pass(s);
    forge_scene_draw_shadow_mesh(s, state->mesh_vb, state->mesh_ib,
                                 state->index_count, model_matrix);
    forge_scene_end_shadow_pass(s);

    /* Main pass (sky drawn automatically) */
    forge_scene_begin_main_pass(s);
    float color[4] = { 0.8f, 0.3f, 0.2f, 1.0f };
    forge_scene_draw_mesh(s, state->mesh_vb, state->mesh_ib,
                          state->index_count, model_matrix, color);
    forge_scene_draw_grid(s);
    forge_scene_end_main_pass(s);

    /* UI pass (optional) */
    float mx, my;
    Uint32 buttons = SDL_GetMouseState(&mx, &my);
    bool mouse_down = !state->scene.mouse_captured
                    && (buttons & SDL_BUTTON_LMASK) != 0;
    forge_scene_begin_ui(s, mx, my, mouse_down);
    ForgeUiWindowContext *wctx = forge_scene_window_ui(s);
    if (wctx) {
        if (forge_ui_wctx_window_begin(wctx, "Title", &state->ui_window)) {
            ForgeUiContext *ui = wctx->ctx;
            /* ... forge_ui_ctx_* widget calls ... */
            forge_ui_wctx_window_end(wctx);
        }
    }
    forge_scene_end_ui(s);

    return forge_scene_end_frame(s);
}

void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
    (void)result;
    app_state *state = appstate;
    if (!state) return;
    /* Release your own GPU buffers before destroying the scene.
     * forge_scene_destroy does NOT track buffers you created via
     * forge_scene_upload_buffer — those are app-owned. */
    SDL_GPUDevice *dev = forge_scene_device(&state->scene);
    if (dev) {
        if (!SDL_WaitForGPUIdle(dev)) {
            SDL_Log("SDL_WaitForGPUIdle failed: %s", SDL_GetError());
        }
        if (state->mesh_vb) SDL_ReleaseGPUBuffer(dev, state->mesh_vb);
        if (state->mesh_ib) SDL_ReleaseGPUBuffer(dev, state->mesh_ib);
    }
    forge_scene_destroy(&state->scene);
    SDL_free(state);
}

ForgeSceneVertex layout

The built-in scene pipeline expects ForgeSceneVertex:

FieldTypeSizeHLSL
positionvec312 BTEXCOORD0
normalvec312 BTEXCOORD1

Total stride: 24 bytes.

When using forge_shapes.h (struct-of-arrays), interleave before upload:

c
for (int i = 0; i < shape->vertex_count; i++) {
    verts[i].position = shape->positions[i];
    verts[i].normal   = shape->normals[i];
}

Configuration

Override fields on ForgeSceneConfig before passing to forge_scene_init:

FieldDefaultPurpose
cam_start_pos(0, 4, 12)Initial camera position
move_speed5.0Camera movement speed
mouse_sensitivity0.003Mouse look sensitivity
fov_deg60.0Vertical field of view
light_dir(0.4, 0.8, 0.6)Direction toward the light (normalized)
shadow_map_size2048Shadow map resolution
font_pathNULLTTF path (NULL disables UI)

Accessors

c
SDL_GPUDevice  *dev = forge_scene_device(s);
float           dt  = forge_scene_dt(s);
mat4            vp  = forge_scene_view_proj(s);
vec3            cam = forge_scene_cam_pos(s);
ForgeUiContext *ui  = forge_scene_ui(s);   /* NULL if UI disabled */

Common mistakes

  • Forgetting to release app-owned buffers. forge_scene_destroy releases the library's internal resources (pipelines, shadow map, grid buffers, UI atlas) but does NOT release buffers you created with forge_scene_upload_buffer. Release those yourself in SDL_AppQuit before calling forge_scene_destroy.

  • Using forge_ui_ctx_label() inside panels. Always use forge_ui_ctx_label_layout() inside panel_begin/end blocks. Absolute coordinates fall outside the panel's clip rect (content starts below the title bar + padding), causing glyph ascenders to be clipped and characters to appear as different letters.

  • Returning SDL_APP_SUCCESS from SDL_AppInit. That means "quit immediately with exit code 0" — not "init succeeded." Return SDL_APP_CONTINUE on success.

  • Using struct-of-arrays data with the scene pipeline. The built-in pipeline expects interleaved ForgeSceneVertex (position + normal, 24 bytes). Interleave forge_shapes.h data before upload.

  • light_dir points TOWARD the light. A positive Y component means the light comes from above. The shader uses normalize(light_dir) directly — no negation needed.

Reference

  • Source: common/scene/forge_scene.h
  • Lesson: lessons/gpu/40-scene-renderer/
  • Shaders: common/scene/shaders/ (HLSL sources + compiled headers)

Frequently asked questions

What does the Forge Scene Renderer AI skill do?

Set up a complete 3D scene with forge_scene.h — shadow mapping, Blinn-Phong lighting, grid floor, sky gradient, FPS camera, and UI in one init call.

Why use Forge Scene Renderer on TypingMind?

Because you install it once and use it with any model. Forge Scene Renderer is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Forge Scene Renderer in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-scene-renderer. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Forge Scene Renderer?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Forge Scene Renderer?

As many as you like. As long as a model supports skills, you can use Forge Scene Renderer with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Forge Scene Renderer AI skill free?

Yes. It is published on GitHub by Nebulavenus under the Zlib license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇