Forge Pipeline Texture Compression logo

Forge Pipeline Texture Compression

Community
Nebulavenus
forge-pipeline-texture-compression

Load GPU block-compressed textures (BC7/BC5) through the asset pipeline. Covers basisu encoding, UASTC transcoding, .ftex format, D3D12 alignment, and normal map channel handling.

Overview

PublisherNebulavenus
Repositoryforge-gpu
Skill nameforge-pipeline-texture-compression
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 Pipeline Texture Compression 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-pipeline-texture-compression
  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-pipeline-texture-compression .claude/skills/forge-pipeline-texture-compression
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Forge Pipeline Texture Compression 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 Pipeline Texture Compression 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 Pipeline Texture Compression 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-pipeline-texture-compression

Load GPU block-compressed textures through forge_scene.h. The asset pipeline compresses textures at build time (basisu → KTX2 → .ftex), and forge_scene_load_pipeline_texture() uploads the pre-transcoded blocks directly to the GPU — no runtime transcoding or mip generation.

Compression pipeline

bash
# Build basisu (once)
cmake --build build --target basisu

# Color textures → BC7 sRGB
basisu -uastc -ktx2 -mipmap -file basecolor.jpg
forge_texture_tool basecolor.ktx2 basecolor.ftex bc7_srgb

# Normal maps → BC5 (requires both flags)
basisu -uastc -ktx2 -mipmap -normal_map -separate_rg_to_color_alpha -file normal.jpg
forge_texture_tool normal.ktx2 normal.ftex bc5_unorm

# Linear textures (metallic-roughness, occlusion) → BC7 linear
basisu -uastc -ktx2 -mipmap -file metallic_roughness.jpg
forge_texture_tool metallic_roughness.ktx2 metallic_roughness.ftex bc7_unorm

Both tools are CPU-only — no GPU required. Works on headless servers.

Format selection

Texture typebasisu flags.ftex formatSDL GPU format
Base color(none)bc7_srgbBC7_RGBA_UNORM_SRGB
Emissive(none)bc7_srgbBC7_RGBA_UNORM_SRGB
Normal map-normal_map -separate_rg_to_color_alphabc5_unormBC5_RG_UNORM
Metallic-roughness(none)bc7_unormBC7_RGBA_UNORM
Occlusion(none)bc7_unormBC7_RGBA_UNORM

Normal map encoding — why both flags matter

-separate_rg_to_color_alpha: The Basis Universal BC5 transcoder reads channels 0 (R) and 3 (Alpha), not 0 (R) and 1 (G). This flag moves G into alpha during UASTC encoding so BC5 gets the correct data. Without it, the Y normal component is lost (all 255).

-normal_map: Treats input as linear data (not sRGB) and optimizes UASTC encoding for angular error rather than perceptual color error.

Sidecar detection

forge_scene_load_pipeline_texture() checks for a .meta.json sidecar next to each texture. If the sidecar has a compression block pointing to a .ftex file, the compressed path is used. Otherwise, it falls back to SDL_LoadSurface + GPU mipmaps.

Example .meta.json:

json
{
  "source": "basecolor.jpg",
  "output": "basecolor.jpg",
  "output_width": 2048,
  "output_height": 2048,
  "compression": {
    "codec": "uastc",
    "container": "ktx2",
    "compressed_file": "basecolor.ktx2",
    "ratio": 6.32,
    "normal_map": true
  }
}

D3D12 alignment requirement

D3D12 requires 256-byte row pitch alignment and 512-byte mip offset alignment for texture uploads. forge_scene_upload_compressed_texture() handles this by padding block rows and aligning offsets in the transfer buffer. Vulkan has no such requirement.

Small BC7/BC5 mips (≤32×32) have row pitches below 256 bytes. Without padding, SDL's D3D12 backend crashes non-deterministically.

Usage pattern

c
#define FORGE_PIPELINE_IMPLEMENTATION
#include "pipeline/forge_pipeline.h"

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

/* Load model — compressed textures are detected automatically */
ForgeSceneModel model;
forge_scene_load_model(&scene, &model,
                       "assets/Model/Model.fscene",
                       "assets/Model/Model.fmesh",
                       "assets/Model/Model.fmat",
                       "assets/Model");

/* Check compression stats */
SDL_Log("Textures: %u/%u compressed, VRAM: %.1f MB (%.1f MB uncompressed)",
        model.vram.compressed_texture_count, model.vram.total_texture_count,
        (float)model.vram.compressed_bytes / (1024.0f * 1024.0f),
        (float)model.vram.uncompressed_bytes / (1024.0f * 1024.0f));

.ftex binary format

text
Header (32 bytes):
  magic       u32    "FTEX" (0x58455446)
  version     u32    1
  format      u32    1=BC7_SRGB, 2=BC7_UNORM, 3=BC5_UNORM
  width       u32    base mip width
  height      u32    base mip height
  mip_count   u32    number of mip levels
  reserved    u32    0
  reserved    u32    0

Mip entries (16 bytes each × mip_count):
  offset      u32    byte offset from file start
  data_size   u32    compressed block data size
  width       u32    mip level width
  height      u32    mip level height

Block data:
  Contiguous compressed blocks, mip 0 first

Shader compatibility

The fragment shader reconstructs Z from RG for normal maps:

hlsl
float2 n_rg = normal_tex.Sample(normal_smp, uv).rg * 2.0 - 1.0;
float3 n = float3(n_rg, sqrt(saturate(1.0 - dot(n_rg, n_rg))));

This works for both BC5 (RG only) and RGBA8 (ignores B, recomputes Z).

Common mistakes

  • Missing -separate_rg_to_color_alpha for normal maps. BC5 transcoding reads R and Alpha channels, not R and G. Without this flag, the Y normal component is all 1.0 and lighting is completely wrong.
  • Missing -normal_map for normal maps. Without it, basisu treats the input as sRGB and optimizes for perceptual color error instead of angular error. Quality degrades.
  • Unaligned compressed texture uploads on D3D12. Small mips (≤32×32) have row pitches below 256 bytes. Pad block rows to 256-byte alignment and align mip offsets to 512 bytes, or SDL's D3D12 backend crashes.
  • Forgetting pixels_per_row after padding. If you pad the transfer buffer but don't set pixels_per_row on SDL_GPUTextureTransferInfo, SDL doesn't know the stride and reads garbage.
  • Using BC7 sRGB for linear data. Metallic-roughness and occlusion textures are linear — use bc7_unorm, not bc7_srgb.

Reference

  • GPU Lesson 42 — full lesson with debugging walkthrough
  • GPU Lesson 41 — model loading foundation
  • common/scene/forge_scene.h — forge_scene_upload_compressed_texture()
  • common/pipeline/forge_pipeline.h — forge_pipeline_load_ftex()
  • tools/texture/main.c — forge_texture_tool (KTX2 → .ftex)

Frequently asked questions

What does the Forge Pipeline Texture Compression AI skill do?

Load GPU block-compressed textures (BC7/BC5) through the asset pipeline. Covers basisu encoding, UASTC transcoding, .ftex format, D3D12 alignment, and normal map channel handling.

Why use Forge Pipeline Texture Compression on TypingMind?

Because you install it once and use it with any model. Forge Pipeline Texture Compression 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 Pipeline Texture Compression in TypingMind?

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

Which AI models can use Forge Pipeline Texture Compression?

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 Pipeline Texture Compression?

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

Is the Forge Pipeline Texture Compression 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 👇