forge-shader-noise
Add GPU noise functions (hash, value, Perlin, fBm, domain warping) to an SDL GPU project
от Nebulavenus★ 51 звезда на GitHub
Установить forge-shader-noise в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Shader Noise
Add procedural noise functions to an SDL GPU fragment shader. Implements GPU-friendly hash functions, value noise, Perlin gradient noise, fBm (fractal Brownian motion), and domain warping — all running per-pixel on the GPU with no texture assets.
When to use
- Procedural textures (marble, wood, clouds, terrain)
- Terrain height and coloring without texture assets
- Dissolve and erosion effects
- Adding organic variation to materials or lighting
- Any situation requiring randomness in a fragment shader
HLSL noise library
Add these functions to your fragment shader. They are self-contained and require no external textures or buffers.
Hash functions
GPU shaders lack rand(). Use deterministic integer hashes instead —
same input always produces the same output.
/* Thomas Wang 32-bit integer hash — good avalanche properties */
uint wang_hash(uint seed)
{
seed = (seed ^ 61u) ^ (seed >> 16u);
seed *= 9u;
seed = seed ^ (seed >> 4u);
seed *= 0x27d4eb2du;
seed = seed ^ (seed >> 15u);
return seed;
}
/* Map hash to float in [0, 1) */
float hash_to_float(uint h)
{
return float(h) / 4294967296.0;
}
/* Combine two hash values (Boost hash_combine pattern) */
uint hash_combine(uint seed, uint value)
{
return seed ^ (value + 0x9e3779b9u + (seed << 6u) + (seed >> 2u));
}
/* Hash 2D integer coordinates to uint */
uint hash2d_uint(int2 p)
{
uint h = wang_hash(uint(p.x));
h = hash_combine(h, uint(p.y));
return wang_hash(h);
}
/* Hash 2D integer coordinates to float in [0, 1) */
float hash2d(int2 p)
{
return hash_to_float(hash2d_uint(p));
}
White noise
Random value per integer cell. Useful for TV static, sparkle effects.
float white_noise(float2 p, float time_seed)
{
int2 ip = int2(floor(p));
uint seed = hash_combine(hash2d_uint(ip), uint(time_seed * 60.0));
return hash_to_float(seed);
}
Value noise
Smoothly interpolated random values at lattice points.
float value_noise(float2 p)
{
int2 i = int2(floor(p));
float2 f = frac(p);
float2 u = f * f * (3.0 - 2.0 * f); /* Hermite smoothstep */
float a = hash2d(i);
float b = hash2d(i + int2(1, 0));
float c = hash2d(i + int2(0, 1));
float d = hash2d(i + int2(1, 1));
return lerp(lerp(a, b, u.x), lerp(c, d, u.x), u.y);
}
Gradient noise (Perlin 2D)
Smoother than value noise with C2 continuity.
float grad2d(uint hash, float2 d)
{
uint h = hash & 3u;
float u = ((h & 1u) != 0u) ? -d.x : d.x;
float v = ((h & 2u) != 0u) ? -d.y : d.y;
return u + v;
}
float2 quintic(float2 t)
{
return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
}
float perlin2d(float2 p)
{
int2 i = int2(floor(p));
float2 f = frac(p);
float2 u = quintic(f);
float a = grad2d(hash2d_uint(i), f);
float b = grad2d(hash2d_uint(i + int2(1, 0)), f - float2(1.0, 0.0));
float c = grad2d(hash2d_uint(i + int2(0, 1)), f - float2(0.0, 1.0));
float d = grad2d(hash2d_uint(i + int2(1, 1)), f - float2(1.0, 1.0));
return lerp(lerp(a, b, u.x), lerp(c, d, u.x), u.y);
}
fBm (fractal Brownian motion)
Stack multiple octaves of Perlin noise for natural fractal detail.
float fbm(float2 p)
{
float value = 0.0;
float amplitude = 0.5;
float frequency = 1.0;
for (int oct = 0; oct < 6; oct++)
{
value += amplitude * perlin2d(p * frequency);
frequency *= 2.0; /* lacunarity */
amplitude *= 0.5; /* persistence */
}
return value;
}
Domain warping
Compose fBm with itself for organic, marble-like patterns.
float domain_warp(float2 p)
{
float2 q = float2(
fbm(p + float2(0.0, 0.0)),
fbm(p + float2(5.2, 1.3))
);
float2 r = float2(
fbm(p + 4.0 * q + float2(1.7, 9.2)),
fbm(p + 4.0 * q + float2(8.3, 2.8))
);
return fbm(p + 4.0 * r);
}
Dithering (Interleaved Gradient Noise)
Break up 8-bit color banding with blue-noise-like dithering.
float ign(float2 screen_pos)
{
float3 ign_coeffs = float3(0.06711056, 0.00583715, 52.9829189);
return frac(ign_coeffs.z * frac(dot(screen_pos, ign_coeffs.xy)));
}
/* Apply after computing final color: */
color += (ign(screen_pos) - 0.5) / 255.0;
Integration pattern
Using noise in an existing scene shader
Add the noise functions to your fragment shader and use them to modify materials, lighting, or geometry:
/* Procedural terrain coloring */
float height = fbm(world_pos.xz * 0.1);
float3 base_color = terrain_color(height);
/* Add organic variation to a material */
float variation = perlin2d(world_pos.xz * 2.0 + time * 0.1);
diffuse_color *= 0.9 + 0.1 * variation;
/* Dissolve effect */
float noise = fbm(world_pos * 3.0);
clip(noise - dissolve_threshold); /* discard if below threshold */
Fullscreen noise visualization
For standalone noise visualization, use the SV_Verte
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл forge-shader-noise?
Add GPU noise functions (hash, value, Perlin, fBm, domain warping) to an SDL GPU project
Как установить скилл forge-shader-noise?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл forge-shader-noise запускает скрипты?
Нет, скилл состоит только из инструкций (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…