forge-procedural-sky
Add a physically-based procedural sky with atmospheric scattering (Rayleigh, Mie, ozone) to an SDL GPU project using per-pixel ray marching with…
от Nebulavenus★ 51 звезда на GitHub
Установить forge-procedural-sky в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Procedural Sky (Hillaire)
Add a physically-based atmospheric sky to an SDL GPU project. Implements Sebastien Hillaire's atmospheric model (EGSR 2020) with LUT-accelerated transmittance and multi-scattering, producing correct sky colors at any time of day.
When to use
- Outdoor scenes that need a dynamic sky background
- Time-of-day systems (sunrise, noon, sunset, twilight, night)
- Replacing static skybox textures with physically correct skies
- Scenes where the sun position changes dynamically
- Any project needing atmospheric scattering (aerial perspective)
Architecture
Render pipeline
6 pipelines: 2 compute (one-time) + 4 graphics (per frame).
One-time compute passes (at startup):
- Transmittance LUT (256×64) — compute shader, 40-step march/texel
- Multi-scattering LUT (32×32) — compute shader, 64 dirs × 20 steps
Per-frame render passes:
- Sky pass — Fullscreen quad, atmosphere ray march + LUT sampling → HDR
- Bloom downsample (5×) — 13-tap Jimenez with Karis → mip chain
- Bloom upsample (4×) — 9-tap tent, additive blend → mip 0
- Tonemap pass — HDR + bloom → swapchain (ACES filmic)
Key shaders
transmittance_lut.comp.hlsl
Compute shader generating the transmittance LUT. Uses Bruneton non-linear UV mapping that concentrates precision near the horizon.
/* Register layout (compute spaces) */
RWTexture2D<float4> output_tex : register(u0, space1); /* RW output */
/* LUT dimensions are compile-time constants — no uniform buffer needed. */
static const float LUT_WIDTH = 256.0;
static const float LUT_HEIGHT = 64.0;
[numthreads(8, 8, 1)]
void main(uint3 id : SV_DispatchThreadID) { ... }
multiscatter_lut.comp.hlsl
Compute shader generating the multi-scattering LUT. Reads the transmittance LUT and integrates over 64 sphere directions.
/* Register layout (compute spaces) */
Texture2D<float4> transmittance_lut : register(t0, space0); /* sampled */
SamplerState trans_sampler : register(s0, space0);
RWTexture2D<float4> output_tex : register(u0, space1); /* RW output */
/* LUT dimensions are compile-time constants — no uniform buffer needed. */
static const float LUT_WIDTH = 32.0;
static const float LUT_HEIGHT = 32.0;
[numthreads(8, 8, 1)]
void main(uint3 id : SV_DispatchThreadID) { ... }
sky.frag.hlsl
All atmosphere constants are static const in the shader. Uniforms
are camera position, sun direction, and march step count. LUT textures
are bound as fragment samplers.
Core functions (implement in this order):
/* 1. Ray-sphere test — find atmosphere entry/exit */
bool ray_sphere_intersect(float3 ro, float3 rd, float radius,
out float t_near, out float t_far);
/* 2. Phase functions — angular scattering distribution */
float rayleigh_phase(float cos_theta); /* (3/16pi)(1+cos^2 theta) */
float mie_phase_hg(float cos_theta, float g); /* Henyey-Greenstein g=0.8 */
/* 3. Medium sampling — density at altitude */
MediumSample sample_medium(float3 pos); /* returns scatter + extinction */
/* 4. LUT sampling — O(1) transmittance lookup */
float3 sample_transmittance(float view_height, float cos_zenith);
/* 5. LUT sampling — multi-scattering lookup */
float3 sample_multiscatter(float altitude, float cos_sun_zenith);
/* 6. Main march — outer loop with LUT-accelerated sampling */
float3 atmosphere(float3 ray_origin, float3 ray_dir,
out float3 transmittance);
/* 7. Sun disc — rendered on top with limb darkening */
float3 sun_disc(float3 ray_dir, float3 sun_dir, float3 transmittance);
Atmosphere constants (Hillaire EGSR 2020, Table 1)
static const float R_GROUND = 6360.0; /* Earth radius (km) */
static const float R_ATMO = 6460.0; /* atmosphere top (km) */
/* Rayleigh — molecular scattering, wavelength-dependent */
static const float3 RAYLEIGH_SCATTER = float3(5.802e-3, 13.558e-3, 33.1e-3);
static const float RAYLEIGH_H = 8.0; /* scale height (km) */
/* Mie — aerosol scattering, nearly white */
static const float MIE_SCATTER = 3.996e-3;
static const float MIE_ABSORB = 0.444e-3;
static const float MIE_H = 1.2;
static const float MIE_G = 0.8; /* forward-peak asymmetry */
/* Ozone — absorption only (no scattering) */
static const float3 OZONE_ABSORB = float3(0.650e-3, 1.881e-3, 0.085e-3);
static const float OZONE_CENTER = 25.0; /* peak altitude (km) */
static const float OZONE_WIDTH = 15.0; /* tent half-width (km) */
Vertex shader: ray matrix reconstruction
cbuffer SkyVertUniforms : register(b0, space1) {
float4x4 ray_matrix; /* maps NDC to world-space directions */
};
/* Map NDC to world-space ray direction via the ray matrix */
float4 world_pos = mul(ray_matrix, float4(ndc.x, ndc.y, 1.0, 1.0));
output.view_ray = world_pos.xyz / world_pos.w;
Fragment shader: LUT bindings
/* LUT textures bound as fragment samplers (space2) */
Texture2D<float4> transmit
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл forge-procedural-sky?
Add a physically-based procedural sky with atmospheric scattering (Rayleigh, Mie, ozone) to an SDL GPU project using per-pixel ray marching with LUT-accelerated transmittance and multi-scattering
Как установить скилл forge-procedural-sky?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл forge-procedural-sky запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…