jpskill.com
✍️ ライティング コミュニティ

shader-dev

レイマーチングや流体シミュレーションなど、GLSLシェーダーを使った高度な視覚効果を駆使し、美しい3Dモデルの生成やライティング、ポストプロセッシングなどを実現するSkill。

📜 元の英語説明(参考)

Comprehensive GLSL shader techniques for creating stunning visual effects — ray marching, SDF modeling, fluid simulation, particle systems, procedural generation, lighting, post-processing, and more.

🇯🇵 日本人クリエイター向け解説

一言でいうと

レイマーチングや流体シミュレーションなど、GLSLシェーダーを使った高度な視覚効果を駆使し、美しい3Dモデルの生成やライティング、ポストプロセッシングなどを実現するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o shader-dev.zip https://jpskill.com/download/19710.zip && unzip -o shader-dev.zip && rm shader-dev.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19710.zip -OutFile "$d\shader-dev.zip"; Expand-Archive "$d\shader-dev.zip" -DestinationPath $d -Force; ri "$d\shader-dev.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して shader-dev.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → shader-dev フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

シェーダー作成

リアルタイム視覚効果のための36種類のGLSLシェーダー技術(ShaderToy互換)を網羅した統合スキルです。

呼び出し

/shader-dev <request>

$ARGUMENTS にはユーザーのリクエスト(例:「ソフトシャドウ付きのレイマーチングSDFシーンを作成してください」)が含まれます。

スキル構造

shader-dev/
├── SKILL.md                      # コアスキル(このファイル)
├── techniques/                   # 実装ガイド(ルーティングテーブルに従って読み込みます)
│   ├── ray-marching.md           # SDFによるスフィアトレーシング
│   ├── sdf-3d.md                 # 3D符号付き距離関数
│   ├── lighting-model.md         # PBR、Phong、トゥーンシェーディング
│   ├── procedural-noise.md       # パーリン、シンプレックス、FBM
│   └── ...                       # その他34の技術ファイル
└── reference/                    # 詳細ガイド(必要に応じて読み込みます)
    ├── ray-marching.md           # 数学的な導出と高度なパターン
    ├── sdf-3d.md                 # 拡張SDF理論
    ├── lighting-model.md         # ライティングの数学的詳細
    ├── procedural-noise.md       # ノイズ関数理論
    └── ...                       # その他34のリファレンスファイル

使用方法

  1. 以下の技術ルーティングテーブルを読んで、ユーザーのリクエストに合致する技術を特定します。
  2. techniques/ から関連するファイルを読み込みます。各ファイルには、コア原則、実装手順、および完全なコードテンプレートが含まれています。
  3. より深い理解(数学的な導出、高度なパターン)が必要な場合は、各技術ファイルの最下部にあるリファレンスリンクをたどって reference/ を参照します。
  4. スタンドアロンのHTMLページを生成する際は、以下のWebGL2適応ルールを適用します。

技術ルーティングテーブル

ユーザーが作成したいもの... 主要技術 組み合わせる技術
数学から3Dオブジェクト/シーン ray-marching + sdf-3d lighting-model, shadow-techniques
複雑な3D形状(ブーリアン、ブレンド) csg-boolean-operations sdf-3d, ray-marching
3Dでの無限に繰り返されるパターン domain-repetition sdf-3d, ray-marching
有機的/歪んだ形状 domain-warping procedural-noise
流体/煙/インク効果 fluid-simulation multipass-buffer
パーティクル効果(炎、火花、雪) particle-system procedural-noise, color-palette
物理ベースのシミュレーション simulation-physics multipass-buffer
ライフゲーム/反応拡散 cellular-automata multipass-buffer, color-palette
海/水面 water-ocean atmospheric-scattering, lighting-model
地形/風景 terrain-rendering atmospheric-scattering, procedural-noise
雲/霧/ボリューム火災 volumetric-rendering procedural-noise, atmospheric-scattering
空/夕焼け/大気 atmospheric-scattering volumetric-rendering
写実的なライティング(PBR、Phong) lighting-model shadow-techniques, ambient-occlusion
影(ソフト/ハード) shadow-techniques lighting-model
アンビエントオクルージョン ambient-occlusion lighting-model, normal-estimation
パストレーシング/大域照明 path-tracing-gi analytic-ray-tracing, multipass-buffer
正確なレイとジオメトリの交差 analytic-ray-tracing lighting-model
ボクセルワールド(Minecraft風) voxel-rendering lighting-model, shadow-techniques
ノイズ/FBMテクスチャ procedural-noise domain-warping
タイル状の2Dパターン procedural-2d-pattern polar-uv-manipulation
ボロノイ/セルパターン voronoi-cellular-noise color-palette
フラクタル(マンデルブロ、ジュリア、3D) fractal-rendering color-palette, polar-uv-manipulation
カラーグレーディング/パレット color-palette
ブルーム/トーンマッピング/グリッチ post-processing multipass-buffer
マルチパスピンポンバッファ multipass-buffer
テクスチャ/サンプリング技術 texture-sampling
カメラ/行列変換 matrix-transform
サーフェス法線 normal-estimation
極座標/万華鏡 polar-uv-manipulation procedural-2d-pattern
SDFからの2D形状/UI sdf-2d color-palette
プロシージャルオーディオ/音楽 sound-synthesis
SDFのトリック/最適化 sdf-tricks sdf-3d, ray-marching
アンチエイリアスレンダリング anti-aliasing sdf-2d, post-processing
被写界深度/モーションブラー/レンズ効果 camera-effects post-processing, multipass-buffer
高度なテクスチャマッピング/タイルなしテクスチャ texture-mapping-advanced terrain-rendering, texture-sampling
WebGL2シェーダーのエラー/デバッグ webgl-pitfalls

技術インデックス

ジオメトリとSDF

  • sdf-2d — 形状、UI、アンチエイリアスレンダリングのための2D符号付き距離関数
  • sdf-3d — リアルタイムの暗黙的表面モデリングのための3D符号付き距離関数
  • csg-boolean-operations — 構成的ソリッドジオメトリ:結合、減算、交差
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Shader Craft

A unified skill covering 36 GLSL shader techniques (ShaderToy-compatible) for real-time visual effects.

Invocation

/shader-dev <request>

$ARGUMENTS contains the user's request (e.g. "create a raymarched SDF scene with soft shadows").

Skill Structure

shader-dev/
├── SKILL.md                      # Core skill (this file)
├── techniques/                   # Implementation guides (read per routing table)
│   ├── ray-marching.md           # Sphere tracing with SDF
│   ├── sdf-3d.md                 # 3D signed distance functions
│   ├── lighting-model.md         # PBR, Phong, toon shading
│   ├── procedural-noise.md       # Perlin, Simplex, FBM
│   └── ...                       # 34 more technique files
└── reference/                    # Detailed guides (read as needed)
    ├── ray-marching.md           # Math derivations & advanced patterns
    ├── sdf-3d.md                 # Extended SDF theory
    ├── lighting-model.md         # Lighting math deep-dive
    ├── procedural-noise.md       # Noise function theory
    └── ...                       # 34 more reference files

How to Use

  1. Read the Technique Routing Table below to identify which technique(s) match the user's request
  2. Read the relevant file(s) from techniques/ — each file contains core principles, implementation steps, and complete code templates
  3. If you need deeper understanding (math derivations, advanced patterns), follow the reference link at the bottom of each technique file to reference/
  4. Apply the WebGL2 Adaptation Rules below when generating standalone HTML pages

Technique Routing Table

User wants to create... Primary technique Combine with
3D objects / scenes from math ray-marching + sdf-3d lighting-model, shadow-techniques
Complex 3D shapes (booleans, blends) csg-boolean-operations sdf-3d, ray-marching
Infinite repeating patterns in 3D domain-repetition sdf-3d, ray-marching
Organic / warped shapes domain-warping procedural-noise
Fluid / smoke / ink effects fluid-simulation multipass-buffer
Particle effects (fire, sparks, snow) particle-system procedural-noise, color-palette
Physically-based simulations simulation-physics multipass-buffer
Game of Life / reaction-diffusion cellular-automata multipass-buffer, color-palette
Ocean / water surface water-ocean atmospheric-scattering, lighting-model
Terrain / landscape terrain-rendering atmospheric-scattering, procedural-noise
Clouds / fog / volumetric fire volumetric-rendering procedural-noise, atmospheric-scattering
Sky / sunset / atmosphere atmospheric-scattering volumetric-rendering
Realistic lighting (PBR, Phong) lighting-model shadow-techniques, ambient-occlusion
Shadows (soft / hard) shadow-techniques lighting-model
Ambient occlusion ambient-occlusion lighting-model, normal-estimation
Path tracing / global illumination path-tracing-gi analytic-ray-tracing, multipass-buffer
Precise ray-geometry intersections analytic-ray-tracing lighting-model
Voxel worlds (Minecraft-style) voxel-rendering lighting-model, shadow-techniques
Noise / FBM textures procedural-noise domain-warping
Tiled 2D patterns procedural-2d-pattern polar-uv-manipulation
Voronoi / cell patterns voronoi-cellular-noise color-palette
Fractals (Mandelbrot, Julia, 3D) fractal-rendering color-palette, polar-uv-manipulation
Color grading / palettes color-palette
Bloom / tone mapping / glitch post-processing multipass-buffer
Multi-pass ping-pong buffers multipass-buffer
Texture / sampling techniques texture-sampling
Camera / matrix transforms matrix-transform
Surface normals normal-estimation
Polar coords / kaleidoscope polar-uv-manipulation procedural-2d-pattern
2D shapes / UI from SDF sdf-2d color-palette
Procedural audio / music sound-synthesis
SDF tricks / optimization sdf-tricks sdf-3d, ray-marching
Anti-aliased rendering anti-aliasing sdf-2d, post-processing
Depth of field / motion blur / lens effects camera-effects post-processing, multipass-buffer
Advanced texture mapping / no-tile textures texture-mapping-advanced terrain-rendering, texture-sampling
WebGL2 shader errors / debugging webgl-pitfalls

Technique Index

Geometry & SDF

  • sdf-2d — 2D signed distance functions for shapes, UI, anti-aliased rendering
  • sdf-3d — 3D signed distance functions for real-time implicit surface modeling
  • csg-boolean-operations — Constructive solid geometry: union, subtraction, intersection with smooth blending
  • domain-repetition — Infinite space repetition, folding, and limited tiling
  • domain-warping — Distort domains with noise for organic, flowing shapes
  • sdf-tricks — SDF optimization, bounding volumes, binary search refinement, hollowing, layered edges, debug visualization

Ray Casting & Lighting

  • ray-marching — Sphere tracing with SDF for 3D scene rendering
  • analytic-ray-tracing — Closed-form ray-primitive intersections (sphere, plane, box, torus)
  • path-tracing-gi — Monte Carlo path tracing for photorealistic global illumination
  • lighting-model — Phong, Blinn-Phong, PBR (Cook-Torrance), and toon shading
  • shadow-techniques — Hard shadows, soft shadows (penumbra estimation), cascade shadows
  • ambient-occlusion — SDF-based AO, screen-space AO approximation
  • normal-estimation — Finite-difference normals, tetrahedron technique

Simulation & Physics

  • fluid-simulation — Navier-Stokes fluid solver with advection, diffusion, pressure projection
  • simulation-physics — GPU-based physics: springs, cloth, N-body gravity, collision
  • particle-system — Stateless and stateful particle systems (fire, rain, sparks, galaxies)
  • cellular-automata — Game of Life, reaction-diffusion (Turing patterns), sand simulation

Natural Phenomena

  • water-ocean — Gerstner waves, FFT ocean, caustics, underwater fog
  • terrain-rendering — Heightfield ray marching, FBM terrain, erosion
  • atmospheric-scattering — Rayleigh/Mie scattering, god rays, SSS approximation
  • volumetric-rendering — Volume ray marching for clouds, fog, fire, explosions

Procedural Generation

  • procedural-noise — Value noise, Perlin, Simplex, Worley, FBM, ridged noise
  • procedural-2d-pattern — Brick, hexagon, truchet, Islamic geometric patterns
  • voronoi-cellular-noise — Voronoi diagrams, Worley noise, cracked earth, crystal
  • fractal-rendering — Mandelbrot, Julia sets, 3D fractals (Mandelbox, Mandelbulb)
  • color-palette — Cosine palettes, HSL/HSV/Oklab, dynamic color mapping

Post-Processing & Infrastructure

  • post-processing — Bloom, tone mapping (ACES, Reinhard), vignette, chromatic aberration, glitch
  • multipass-buffer — Ping-pong FBO setup, state persistence across frames
  • texture-sampling — Bilinear, bicubic, mipmap, procedural texture lookup
  • matrix-transform — Camera look-at, projection, rotation, orbit controls
  • polar-uv-manipulation — Polar/log-polar coordinates, kaleidoscope, spiral mapping
  • anti-aliasing — SSAA, SDF analytical AA, temporal anti-aliasing (TAA), FXAA post-process
  • camera-effects — Depth of field (thin lens), motion blur, lens distortion, film grain, vignette
  • texture-mapping-advanced — Biplanar mapping, texture repetition avoidance, ray differential filtering

Audio

  • sound-synthesis — Procedural audio in GLSL: oscillators, envelopes, filters, FM synthesis

Debugging & Validation

  • webgl-pitfalls — Common WebGL2/GLSL errors: fragCoord, main() wrapper, function order, macro limitations, uniform null

WebGL2 Adaptation Rules

All technique files use ShaderToy GLSL style. When generating standalone HTML pages, apply these adaptations:

Shader Version & Output

  • Use canvas.getContext("webgl2")
  • Shader first line: #version 300 es, fragment shader adds precision highp float;
  • Fragment shader must declare: out vec4 fragColor;
  • Vertex shader: attributein, varyingout
  • Fragment shader: varyingin, gl_FragColorfragColor, texture2D()texture()

Fragment Coordinate

  • Use gl_FragCoord.xy instead of fragCoord (WebGL2 does not have fragCoord built-in)
    // WRONG
    vec2 uv = (2.0 * fragCoord - iResolution.xy) / iResolution.y;
    // CORRECT
    vec2 uv = (2.0 * gl_FragCoord.xy - iResolution.xy) / iResolution.y;

main() Wrapper for ShaderToy Templates

  • ShaderToy uses void mainImage(out vec4 fragColor, in vec2 fragCoord)
  • WebGL2 requires standard void main() entry point — always wrap mainImage:
    
    void mainImage(out vec4 fragColor, in vec2 fragCoord) {
      // shader code...
      fragColor = vec4(col, 1.0);
    }

void main() { mainImage(fragColor, gl_FragCoord.xy); }


### Function Declaration Order
- GLSL requires functions to be declared before use — either declare before use or reorder:
```glsl
// WRONG — getAtmosphere() calls getSunDirection() before it's defined
vec3 getAtmosphere(vec3 dir) { return getSunDirection(); } // Error!
vec3 getSunDirection() { return normalize(vec3(1.0)); }

// CORRECT — define callee first
vec3 getSunDirection() { return normalize(vec3(1.0)); }
vec3 getAtmosphere(vec3 dir) { return getSunDirection(); } // Works

Macro Limitations

  • #define cannot use function calls — use const instead:
    
    // WRONG
    #define SUN_DIR normalize(vec3(0.8, 0.4, -0.6))

// CORRECT const vec3 SUN_DIR = vec3(0.756, 0.378, -0.567); // Pre-computed normalized value


### Script Tag Extraction
- When extracting shader source from `<script>` tags, ensure `#version` is the **first character** — use `.trim()`:
```javascript
const fs = document.getElementById('fs').text.trim();

Common Pitfalls

  • Unused uniforms: Compiler may optimize away unused uniforms, causing gl.getUniformLocation() to return null — always use uniforms in a way the compiler cannot optimize out
  • Loop indices: Use runtime constants in loops, not #define macros in some ES versions
  • Terrain functions: Functions like terrainM(vec2) need XZ components — use terrainM(pos.xz + offset) not terrainM(pos + offset)

HTML Page Setup

When generating a standalone HTML page:

  • Canvas fills the entire viewport, auto-resizes on window resize
  • Page background black, no scrollbars: body { margin: 0; overflow: hidden; background: #000; }
  • Implement ShaderToy-compatible uniforms: iTime, iResolution, iMouse, iFrame
  • For multi-pass effects (Buffer A/B), use WebGL2 framebuffer + ping-pong (see multipass-buffer technique)

Common Pitfalls

JS Variable Declaration Order (TDZ — causes white screen crash)

let/const variables must be declared at the top of the <script> block, before any function that references them:

// 1. State variables FIRST
let frameCount = 0;
let startTime = Date.now();

// 2. Canvas/GL init, shader compile, FBO creation
const canvas = document.getElementById('canvas');
const gl = canvas.getContext('webgl2');
// ...

// 3. Functions and event bindings LAST
function resize() { /* can now safely reference frameCount */ }
function render() { /* ... */ }
window.addEventListener('resize', resize);

Reason: let/const have a Temporal Dead Zone — referencing them before declaration throws ReferenceError, causing a white screen.

GLSL Compilation Errors (self-check after writing shaders)

  • Function signature mismatch: Call must exactly match definition in parameter count and types. If defined as float fbm(vec3 p), cannot call fbm(uv) with a vec2
  • Reserved words as variable names: Do not use: patch, cast, sample, filter, input, output, common, partition, active
  • Strict type matching: vec3 x = 1.0 is illegal — use vec3 x = vec3(1.0); cannot use .z to access a vec2
  • No ternary on structs: ESSL does not allow ternary operator on struct types — use if/else instead

Performance Budget

Deployment environments may use headless software rendering with limited GPU power. Stay within these limits:

  • Ray marching main loop: ≤ 128 steps
  • Volume sampling / lighting inner loops: ≤ 32 steps
  • FBM octaves: ≤ 6 layers
  • Total nested loop iterations per pixel: ≤ 1000 (exceeding this freezes the browser)

Quick Recipes

Common effect combinations — complete rendering pipelines assembled from technique modules.

Photorealistic SDF Scene

  1. Geometry: sdf-3d (extended primitives) + csg-boolean-operations (cubic/quartic smin)
  2. Rendering: ray-marching + normal-estimation (tetrahedron method)
  3. Lighting: lighting-model (outdoor three-light model) + shadow-techniques (improved soft shadow) + ambient-occlusion
  4. Atmosphere: atmospheric-scattering (height-based fog with sun tint)
  5. Post: post-processing (ACES tone mapping) + anti-aliasing (2x SSAA) + camera-effects (vignette)

Organic / Biological Forms

  1. Geometry: sdf-3d (extended primitives + deformation operators: twist, bend) + csg-boolean (gradient-aware smin for material blending)
  2. Detail: procedural-noise (FBM with derivatives) + domain-warping
  3. Surface: lighting-model (subsurface scattering approximation via half-Lambert)

Procedural Landscape

  1. Terrain: terrain-rendering + procedural-noise (erosion FBM with derivatives)
  2. Texturing: texture-mapping-advanced (biplanar mapping + no-tile)
  3. Sky: atmospheric-scattering (Rayleigh/Mie + height fog)
  4. Water: water-ocean (Gerstner waves) + lighting-model (Fresnel reflections)

Stylized 2D Art

  1. Shapes: sdf-2d (extended library) + sdf-tricks (layered edges, hollowing)
  2. Color: color-palette (cosine palettes) + polar-uv-manipulation (kaleidoscope)
  3. Polish: anti-aliasing (SDF analytical AA) + post-processing (bloom, chromatic aberration)

Shader Debugging Techniques

Visual debugging methods — temporarily replace your output to diagnose issues.

What to check Code What to look for
Surface normals col = nor * 0.5 + 0.5; Smooth gradients = correct normals; banding = epsilon too large
Ray march step count col = vec3(float(steps) / float(MAX_STEPS)); Red hotspots = performance bottleneck; uniform = wasted iterations
Depth / distance col = vec3(t / MAX_DIST); Verify correct hit distances
UV coordinates col = vec3(uv, 0.0); Check coordinate mapping
SDF distance field col = (d > 0.0 ? vec3(0.9,0.6,0.3) : vec3(0.4,0.7,0.85)) * (0.8 + 0.2*cos(150.0*d)); Visualize SDF bands and zero-crossing
Checker pattern (UV) col = vec3(mod(floor(uv.x*10.)+floor(uv.y*10.), 2.0)); Verify UV distortion, seams
Lighting only col = vec3(shadow); or col = vec3(ao); Isolate shadow/AO contributions
Material ID col = palette(matId / maxMatId); Verify material assignment