Command Palette

Search for a command to run...

Назад к скиллам
скилл № 89599

forge-screen-space-reflections

Add screen-space reflections (SSR) with ray marching to an SDL GPU project. Use when someone needs realistic reflections on surfaces without expensive cube…

БесплатноБез исполняемых скриптов
Nebulavenusот Nebulavenus★ 51 звезда на GitHub

Установить forge-screen-space-reflections в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Screen-Space Reflections — SDL3 GPU Skill

Implement realistic reflections by ray marching through screen space, sampling depth and normal data to compute accurate reflection rays.

When to use this skill

  • Adding reflections to wet surfaces, mirrors, or polished floors
  • Building a deferred rendering pipeline with multiple render targets (MRT)
  • Avoiding the cost of cube maps or reflective capture probes
  • Combining shadow mapping with reflective surfaces
  • Creating a G-buffer (geometry buffer) to decouple lighting from reflections

G-buffer texture creation

Create the main textures for deferred rendering:

/* 1. Color + reflectivity (R8G8B8A8) */
SDL_GPUTextureCreateInfo color_info;
SDL_zero(color_info);
color_info.type   = SDL_GPU_TEXTURETYPE_2D;
color_info.format = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM;
color_info.usage  = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER;
color_info.width  = width;
color_info.height = height;
SDL_GPUTexture *color_tex = SDL_CreateGPUTexture(device, &color_info);

/* 2. Normals (R16G16B16A16_FLOAT for precision) */
SDL_GPUTextureCreateInfo normal_info;
SDL_zero(normal_info);
normal_info.type   = SDL_GPU_TEXTURETYPE_2D;
normal_info.format = SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT;
normal_info.usage  = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER;
normal_info.width  = width;
normal_info.height = height;
SDL_GPUTexture *normal_tex = SDL_CreateGPUTexture(device, &normal_info);

/* 3. World position (R16G16B16A16_FLOAT for SSR ray marching) */
SDL_GPUTextureCreateInfo pos_info;
SDL_zero(pos_info);
pos_info.type   = SDL_GPU_TEXTURETYPE_2D;
pos_info.format = SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT;
pos_info.usage  = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER;
pos_info.width  = width;
pos_info.height = height;
SDL_GPUTexture *pos_tex = SDL_CreateGPUTexture(device, &pos_info);

/* 4. Depth (D32_FLOAT for precision) */
SDL_GPUTextureCreateInfo depth_info;
SDL_zero(depth_info);
depth_info.type   = SDL_GPU_TEXTURETYPE_2D;
depth_info.format = SDL_GPU_TEXTUREFORMAT_D32_FLOAT;
depth_info.usage  = SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER;
depth_info.width  = width;
depth_info.height = height;
SDL_GPUTexture *depth_tex = SDL_CreateGPUTexture(device, &depth_info);

/* 5. SSR output (R8G8B8A8 for reflection color) */
SDL_GPUTextureCreateInfo ssr_info;
SDL_zero(ssr_info);
ssr_info.type   = SDL_GPU_TEXTURETYPE_2D;
ssr_info.format = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM;
ssr_info.usage  = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER;
ssr_info.width  = width;
ssr_info.height = height;
SDL_GPUTexture *ssr_tex = SDL_CreateGPUTexture(device, &ssr_info);

Render pass order

1. Shadow pass (standard depth pass)

Render depth from light viewpoint to shadow map. Used in G-buffer pass for shadow computation.

2. G-buffer pass (MRT: color, normals, world position)

/* Create colorful render pass with 3 color targets + depth */
SDL_GPURenderPass *render_pass = SDL_BeginGPURenderPass(
    cmd_buf,
    NULL,  /* No color targets for this example, using targets array */
    0,
    depth_tex,
    &(SDL_GPUColorTargetInfo) {
        .texture = color_tex,
        .load_op = SDL_GPU_LOADOP_CLEAR,
        .store_op = SDL_GPU_STOREOP_STORE,
        .clear_color = { 0.0f, 0.0f, 0.0f, 1.0f }
    }
);

/* Bind normal, position, color targets */
SDL_GPUColorTargetInfo targets[3] = {
    {
        .texture = color_tex,
        .load_op = SDL_GPU_LOADOP_CLEAR,
        .store_op = SDL_GPU_STOREOP_STORE,
        .clear_color = { 0.0f, 0.0f, 0.0f, 1.0f }
    },
    {
        .texture = normal_tex,
        .load_op = SDL_GPU_LOADOP_CLEAR,
        .store_op = SDL_GPU_STOREOP_STORE,
        .clear_color = { 0.5f, 0.5f, 1.0f, 0.0f }  /* Default normal */
    },
    {
        .texture = pos_tex,
        .load_op = SDL_GPU_LOADOP_CLEAR,
        .store_op = SDL_GPU_STOREOP_STORE,
        .clear_color = { 0.0f, 0.0f, 0.0f, 0.0f }
    }
};

SDL_GPURenderPass *render_pass = SDL_BeginGPURenderPass(
    cmd_buf,
    targets,
    3,  /* 3 color targets */
    depth_tex,
    NULL  /* No depth target info needed here */
);

/* Bind G-buffer pipeline and render geometry */
SDL_BindGPUGraphicsPipeline(render_pass, gbuffer_pipe);
SDL_DrawGPUPrimitives(render_pass, vertex_count, 1, 0, 0);

SDL_EndGPURenderPass(render_pass);

3. SSR ray march pass (fullscreen quad)

/* SSR uniform buffer structure */
typedef struct {
    mat4 proj;                  /* Projection matrix */
    mat4 proj_inv;              /* Inverse projection */
    mat4 view;                  /* View matrix */
    vec3 camera_pos;            /* Camera position in world space */
    float max_distance;         /* Max ray march distance */
    vec3 padding1;
    float max_steps;            /* Ray march step count */
    float step_size;            /* Initial step size */
    float thickness;            /* Thickness for d
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл forge-screen-space-reflections?

Add screen-space reflections (SSR) with ray marching to an SDL GPU project. Use when someone needs realistic reflections on surfaces without expensive cube maps or environment probes, working with deferred rendering.

Как установить скилл forge-screen-space-reflections?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл forge-screen-space-reflections запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить forge-screen-space-reflections с