Logo Forge Bloom

Forge Bloom

Cộng đồng
Nebulavenus
forge-bloom

Add Jimenez dual-filter bloom to an SDL GPU project with HDR rendering. Implements 13-tap downsample with Karis averaging and 9-tap tent-filter upsample with additive blending.

Tổng quan

Nhà phát hànhNebulavenus
Kho mãforge-gpu
Tên kỹ năngforge-bloom
Sao
46
Bản fork
7
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépZlib
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được Nebulavenus công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Forge Bloom trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-bloom
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân 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-bloom .claude/skills/forge-bloom
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Forge Bloom trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Forge Bloom ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Forge Bloom với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Add Jimenez dual-filter bloom (SIGGRAPH 2014) to an SDL GPU project that already has HDR rendering (floating-point render target + tone mapping).

Prerequisites

  • HDR render target (R16G16B16A16_FLOAT) with COLOR_TARGET + SAMPLER usage
  • Tone mapping pass (fullscreen quad, HDR → swapchain)
  • Bright HDR values in the scene (emissive objects, specular highlights > 1.0)

Architecture

Bloom mip chain

Create 5 half-resolution HDR textures, each with COLOR_TARGET + SAMPLER:

c
#define BLOOM_MIP_COUNT 5
#define HDR_FORMAT SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT

/* For 1280x720: 640x360 → 320x180 → 160x90 → 80x45 → 40x22 */
Uint32 w = hdr_width / 2, h = hdr_height / 2;
for (int i = 0; i < BLOOM_MIP_COUNT; i++) {
    bloom_mips[i] = create_texture(device, HDR_FORMAT, w, h,
        SDL_GPU_TEXTUREUSAGE_COLOR_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER);
    bloom_widths[i] = w;
    bloom_heights[i] = h;
    w /= 2; h /= 2;
}

Pipelines (3 bloom-specific)

PipelineVertexFragmentBlendDepth
downsamplefullscreen.vert (SV_VertexID)bloom_downsample.fragNoneNo
upsamplefullscreen.vert (SV_VertexID)bloom_upsample.fragAdditive (ONE+ONE)No
tonemapfullscreen.vert (SV_VertexID)tonemap.fragNoneNo

Upsample blend state (critical)

c
color_desc.blend_state.enable_blend = true;
color_desc.blend_state.src_color_blendfactor = SDL_GPU_BLENDFACTOR_ONE;
color_desc.blend_state.dst_color_blendfactor = SDL_GPU_BLENDFACTOR_ONE;
color_desc.blend_state.color_blend_op = SDL_GPU_BLENDOP_ADD;
color_desc.blend_state.src_alpha_blendfactor = SDL_GPU_BLENDFACTOR_ONE;
color_desc.blend_state.dst_alpha_blendfactor = SDL_GPU_BLENDFACTOR_ONE;
color_desc.blend_state.alpha_blend_op = SDL_GPU_BLENDOP_ADD;

Bloom sampler

Use LINEAR / CLAMP_TO_EDGE — the bilinear filtering is essential for quality:

c
sampler_info.min_filter = SDL_GPU_FILTER_LINEAR;
sampler_info.mag_filter = SDL_GPU_FILTER_LINEAR;
sampler_info.address_mode_u = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE;
sampler_info.address_mode_v = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE;

Per-frame render passes

text
1. Scene pass → hdr_target (existing)

2. Bloom downsample (5 passes):
   Pass 0: hdr_target → bloom_mips[0]  (threshold + Karis)
   Pass 1: bloom_mips[0] → bloom_mips[1]  (standard weights)
   Pass 2-4: same pattern

3. Bloom upsample (4 passes, LOAD + additive blend):
   Pass 0: bloom_mips[4] → ADD to bloom_mips[3]
   Pass 1: bloom_mips[3] → ADD to bloom_mips[2]
   Pass 2-3: same pattern

4. Tonemap pass → swapchain
   Sample hdr_target + bloom_mips[0]
   output = tonemap((hdr + bloom * bloom_intensity) * exposure)

Downsample uniforms

c
typedef struct BloomDownsampleUniforms {
    float texel_size[2];  /* 1/source_width, 1/source_height */
    float threshold;      /* brightness cutoff (first pass only) */
    float use_karis;      /* 1.0 first pass, 0.0 rest */
} BloomDownsampleUniforms;

Upsample uniforms

c
typedef struct BloomUpsampleUniforms {
    float texel_size[2];  /* 1/source_width, 1/source_height */
    float _pad[2];
} BloomUpsampleUniforms;

Downsample pass loop

c
for (int i = 0; i < BLOOM_MIP_COUNT; i++) {
    /* Render to bloom_mips[i] with CLEAR */
    /* Source: i==0 ? hdr_target : bloom_mips[i-1] */
    /* Texel size: 1/source dimensions */
    ds_u.use_karis = (i == 0) ? 1.0f : 0.0f;
    ds_u.threshold = bloom_threshold;
}

Upsample pass loop

c
for (int i = BLOOM_MIP_COUNT - 2; i >= 0; i--) {
    /* Render to bloom_mips[i] with LOAD (preserve existing data) */
    /* Source: bloom_mips[i+1] (smaller mip) */
    /* Additive blend adds upsampled result on top */
}

Key API calls

Each bloom pass is a separate render pass. The key SDL GPU calls per pass:

c
/* Begin a render pass targeting one bloom mip */
SDL_GPURenderPass *pass = SDL_BeginGPURenderPass(cmd, &color_info, 1, NULL);
SDL_BindGPUGraphicsPipeline(pass, pipeline);          /* downsample or upsample */
SDL_BindGPUFragmentSamplers(pass, 0, &sampler_bind, 1); /* source texture + sampler */
SDL_PushGPUFragmentUniformData(cmd, 0, &uniforms, sizeof(uniforms));
SDL_DrawGPUPrimitives(pass, 3, 1, 0, 0);             /* fullscreen triangle */
SDL_EndGPURenderPass(pass);
  • Downsample pass: color_info.load_op = SDL_GPU_LOADOP_CLEAR
  • Upsample pass: color_info.load_op = SDL_GPU_LOADOP_LOAD (preserve downsample data; the additive blend state on the pipeline accumulates)
  • Tonemap pass: Bind both hdr_target and bloom_mips[0] as fragment samplers, combine before tone mapping

Code template

Minimal copy-ready skeleton for the per-frame bloom passes:

c
/* ── Downsample: extract bright areas and progressively blur ───────── */
BloomDownsampleUniforms ds_u;
for (int i = 0; i < BLOOM_MIP_COUNT; i++) {
    /* Source is HDR target for first pass, previous mip for the rest */
    SDL_GPUTexture *src = (i == 0) ? hdr_target : bloom_mips[i - 1];
    Uint32 src_w = (i == 0) ? hdr_width : bloom_widths[i - 1];
    Uint32 src_h = (i == 0) ? hdr_height : bloom_heights[i - 1];

    ds_u.texel_size[0] = 1.0f / (float)src_w;
    ds_u.texel_size[1] = 1.0f / (float)src_h;
    ds_u.threshold = bloom_threshold;
    ds_u.use_karis = (i == 0) ? 1.0f : 0.0f;

    /* Render to bloom_mips[i], CLEAR load op */
    SDL_GPUColorTargetInfo color_info;
    SDL_zero(color_info);
    color_info.texture = bloom_mips[i];
    color_info.load_op = SDL_GPU_LOADOP_CLEAR;
    color_info.store_op = SDL_GPU_STOREOP_STORE;

    SDL_GPURenderPass *pass = SDL_BeginGPURenderPass(cmd, &color_info, 1, NULL);
    SDL_BindGPUGraphicsPipeline(pass, downsample_pipeline);
    SDL_GPUTextureSamplerBinding bind = { .texture = src, .sampler = bloom_sampler };
    SDL_BindGPUFragmentSamplers(pass, 0, &bind, 1);
    SDL_PushGPUFragmentUniformData(cmd, 0, &ds_u, sizeof(ds_u));
    SDL_DrawGPUPrimitives(pass, 3, 1, 0, 0);
    SDL_EndGPURenderPass(pass);
}

/* ── Upsample: progressively add back detail with additive blend ───── */
BloomUpsampleUniforms us_u;
for (int i = BLOOM_MIP_COUNT - 2; i >= 0; i--) {
    /* Source is the smaller (i+1) mip */
    us_u.texel_size[0] = 1.0f / (float)bloom_widths[i + 1];
    us_u.texel_size[1] = 1.0f / (float)bloom_heights[i + 1];

    /* Render to bloom_mips[i], LOAD to preserve downsample data */
    SDL_GPUColorTargetInfo color_info;
    SDL_zero(color_info);
    color_info.texture = bloom_mips[i];
    color_info.load_op = SDL_GPU_LOADOP_LOAD;   /* critical: preserve existing data */
    color_info.store_op = SDL_GPU_STOREOP_STORE;

    SDL_GPURenderPass *pass = SDL_BeginGPURenderPass(cmd, &color_info, 1, NULL);
    SDL_BindGPUGraphicsPipeline(pass, upsample_pipeline);  /* has additive blend */
    SDL_GPUTextureSamplerBinding bind = {
        .texture = bloom_mips[i + 1], .sampler = bloom_sampler
    };
    SDL_BindGPUFragmentSamplers(pass, 0, &bind, 1);
    SDL_PushGPUFragmentUniformData(cmd, 0, &us_u, sizeof(us_u));
    SDL_DrawGPUPrimitives(pass, 3, 1, 0, 0);
    SDL_EndGPURenderPass(pass);
}

Common mistakes

  1. CLEAR instead of LOAD on upsample — The upsample pass MUST use SDL_GPU_LOADOP_LOAD to preserve the downsample data. CLEAR would erase it, losing the multi-scale effect.

  2. Wrong texel size — The texel size must be 1/source dimensions, not 1/destination. The shader samples the source texture.

  3. Missing LINEAR sampler — Using NEAREST for bloom sampling produces blocky artifacts. The bilinear filter is part of the algorithm's design.

  4. Bloom added after tone mapping — Bloom must be added to HDR values BEFORE tone mapping, so the combined result compresses naturally. Adding after tone mapping causes bloom highlights to clip.

  5. Not recreating mip chain on resize — The bloom mip dimensions depend on the window size. Release and recreate on resize.

Reference

  • GPU Lesson 22 — Bloom
  • Jorge Jimenez, "Next Generation Post Processing in Call of Duty: Advanced Warfare," SIGGRAPH 2014

Câu hỏi thường gặp

Kỹ năng AI Forge Bloom làm được gì?

Add Jimenez dual-filter bloom to an SDL GPU project with HDR rendering. Implements 13-tap downsample with Karis averaging and 9-tap tent-filter upsample with additive blending.

Vì sao nên dùng Forge Bloom trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Forge Bloom là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Forge Bloom trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-bloom. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Forge Bloom?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Forge Bloom với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Forge Bloom với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Forge Bloom có miễn phí không?

Có. Kỹ năng này được Nebulavenus phát hành trên GitHub theo giấy phép Zlib. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇