Forge Uniforms And Motion logo

Forge Uniforms And Motion

Community
Nebulavenus
forge-uniforms-and-motion

Pass per-frame data to shaders with push uniforms. Use when animating geometry, passing time/matrices/colors to shaders, or setting up uniform buffers in SDL3 GPU.

Overview

PublisherNebulavenus
Repositoryforge-gpu
Skill nameforge-uniforms-and-motion
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 Uniforms And Motion 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-uniforms-and-motion
  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-uniforms-and-motion .claude/skills/forge-uniforms-and-motion
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Forge Uniforms And Motion 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 Uniforms And Motion 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 Uniforms And Motion 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.

Uniforms & Motion — Push Uniforms for Per-Frame Data

This skill teaches how to pass data from the CPU to GPU shaders every frame using SDL3's push uniform API. It builds on the first-triangle skill (vertex buffers, shaders, pipeline).

When to use

  • Passing per-frame data to shaders (time, matrices, colors, parameters)
  • Animating geometry on the GPU
  • Setting up uniform buffers in a graphics pipeline
  • Any draw call that needs data beyond vertex attributes

Push uniforms vs. GPU uniform buffers

MethodWhen to use
Push uniforms (SDL_PushGPUVertexUniformData)Small data that changes frequently — time, MVP matrices, colors
GPU uniform buffer (create + upload)Large or rarely-changing data

Push uniforms are the simple path: push a pointer to a C struct, SDL copies it internally. No buffer creation, no transfer buffers, no copy passes.

Uniform data struct

Define a C struct matching your shader's cbuffer layout:

c
typedef struct Uniforms {
    float time;     /* elapsed time in seconds                     */
    float aspect;   /* window width / height — for correcting NDC  */
} Uniforms;

std140 layout rules: vec3 and vec4 fields must be 16-byte aligned. A single float or a float4 is naturally aligned. If you mix types, add padding.

HLSL shader convention

SDL GPU maps uniform buffer slots to specific HLSL registers:

StageSlot 0 registerSlot 1 register
Vertexregister(b0, space1)register(b1, space1)
Fragmentregister(b0, space3)register(b1, space3)
hlsl
/* Vertex shader — uniform slot 0 */
cbuffer Uniforms : register(b0, space1)
{
    float time;
    float aspect;
};

VSOutput main(VSInput input)
{
    /* Correct for non-square windows BEFORE rotation so the triangle
     * keeps its shape at every angle.  If done after, the squish
     * would distort the already-rotated coordinates. */
    float2 corrected = float2(input.position.x / aspect, input.position.y);

    float c = cos(time);
    float s = sin(time);

    float2 rotated;
    rotated.x = corrected.x * c - corrected.y * s;
    rotated.y = corrected.x * s + corrected.y * c;

    VSOutput output;
    output.position = float4(rotated, 0.0, 1.0);
    output.color    = float4(input.color, 1.0);
    return output;
}

Shader creation — declaring uniform count

When creating a shader, num_uniform_buffers must match the number of cbuffers your shader code declares:

c
SDL_GPUShaderCreateInfo info = { 0 };
info.stage               = SDL_GPU_SHADERSTAGE_VERTEX;
info.entrypoint          = "main";
info.num_uniform_buffers = 1;   /* ← must match shader's cbuffer count */
info.num_samplers        = 0;
info.num_storage_textures = 0;
info.num_storage_buffers = 0;
/* ... code, code_size, format ... */

SDL_GPUShader *shader = SDL_CreateGPUShader(device, &info);

Pushing uniform data — each frame

c
/* 1. Compute your per-frame data */
float elapsed = (float)(SDL_GetTicks() - start_ticks) / 1000.0f;

int w = 0, h = 0;
SDL_GetWindowSizeInPixels(window, &w, &h);

Uniforms uniforms;
uniforms.time   = elapsed;
uniforms.aspect = (h > 0) ? (float)w / (float)h : 1.0f;

/* 2. Acquire command buffer */
SDL_GPUCommandBuffer *cmd = SDL_AcquireGPUCommandBuffer(device);

/* 3. Push BEFORE the render pass */
SDL_PushGPUVertexUniformData(cmd, 0, &uniforms, sizeof(uniforms));

/* 4. Begin render pass and draw as usual */
SDL_GPURenderPass *pass = SDL_BeginGPURenderPass(cmd, &color_target, 1, NULL);
SDL_BindGPUGraphicsPipeline(pass, pipeline);
SDL_BindGPUVertexBuffers(pass, 0, &binding, 1);
SDL_DrawGPUPrimitives(pass, vertex_count, 1, 0, 0);
SDL_EndGPURenderPass(pass);

SDL_SubmitGPUCommandBuffer(cmd);

Key details:

  • Push happens on the command buffer, not the render pass
  • Push before SDL_BeginGPURenderPass — SDL latches the data at pass start
  • Data is copied internally — your struct can live on the stack
  • Slot 0 in the push call matches b0 in the HLSL register
  • Each stage (vertex/fragment) has 4 independent slots (0–3)
  • Data persists in a slot until you push new data to it

Fragment shader uniforms

Same pattern, different function and register space:

c
SDL_PushGPUFragmentUniformData(cmd, 0, &frag_uniforms, sizeof(frag_uniforms));
hlsl
cbuffer FragUniforms : register(b0, space3)    /* space3 for fragment */
{
    float brightness;
};

Tracking time

c
/* In app_state */
Uint64 start_ticks;

/* In SDL_AppInit */
state->start_ticks = SDL_GetTicks();

/* In SDL_AppIterate */
float elapsed = (float)(SDL_GetTicks() - state->start_ticks) / 1000.0f;

SDL_GetTicks() returns milliseconds since SDL_Init. Dividing by 1000 gives seconds as a float — ideal for shader math like sin(time) and cos(time).

Common mistakes

MistakeFix
num_uniform_buffers = 0 but shader has a cbufferMust match — set to 1 (or however many cbuffers your shader declares)
Pushing uniform data after SDL_BeginGPURenderPassPush before the render pass — SDL latches uniforms at pass start
Wrong register space in HLSLVertex = space1, Fragment = space3
Forgetting std140 alignment for vec3/vec4Pad structs so vec3/vec4 start at 16-byte boundaries
Using SDL_PushGPUVertexUniformData for fragment dataUse SDL_PushGPUFragmentUniformData for fragment stage
Not declaring num_uniform_buffers on the fragment shaderEach stage declares its own count independently
Rotation looks skewed on non-square windowsPass aspect ratio as uniform, divide x by it before rotation
Aspect correction applied after rotationTriangle skews at certain angles — correct before rotating so you rotate in uniform space
Triangle wobbles instead of spinning in placeCenter vertices so centroid is at origin (average of all positions = 0,0)

Cleanup

No extra cleanup needed for push uniforms — there are no GPU buffer objects to release. The only cleanup is the same as Lesson 02 (pipeline, vertex buffer, window, device).

Frequently asked questions

What does the Forge Uniforms And Motion AI skill do?

Pass per-frame data to shaders with push uniforms. Use when animating geometry, passing time/matrices/colors to shaders, or setting up uniform buffers in SDL3 GPU.

Why use Forge Uniforms And Motion on TypingMind?

Because you install it once and use it with any model. Forge Uniforms And Motion 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 Uniforms And Motion in TypingMind?

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

Which AI models can use Forge Uniforms And Motion?

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 Uniforms And Motion?

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

Is the Forge Uniforms And Motion 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 👇