본문으로 건너뛰기
Skillpedia
일반 코딩6.6k · #13805

shader-programming

하는 일

셰이더가 어떻게 작동하는지 설명하고, 디졸브, 외곽선, 림 라이트 같은 흔한 시각 효과를 만드는 방법을 보여 줍니다. 이런 효과를 원하는 게임 개발자와 테크니컬 아티스트를 위한 스킬입니다.

사용하는 경우

  • ✓스프라이트나 모델에 디졸브, 외곽선, 림 라이트 같은 시각 효과가 필요할 때.
  • ✓UV, 좌표 공간, 버텍스와 프래그먼트 단계를 이해해야 할 때.
  • ✓GLSL과 HLSL 사이, 또는 엔진 사이에서 셰이더를 옮기고 싶을 때.

스킬 링크

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/shader-programming/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/shader-programming/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 캐릭터 스프라이트가 가장자리에서부터 사라지게 하고, 밝은 외곽선을 더하는 셰이더를 작성해 주시겠어요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 각 단계가 무엇을 하는지 설명한 뒤, UV 좌표와 노이즈 값을 써서 픽셀을 서서히 지우는 프래그먼트 셰이더를 작성합니다. 외곽선은 주변 픽셀을 샘플링해 추가하며, GLSL로 쓰고 HLSL 대응 코드를 함께 제공합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Shader programming (cross-engine)

Shaders are small programs that run per vertex and per pixel on the GPU. The concepts — the pipeline, coordinate spaces, UVs, and how common effects are built — port across engines; only the language dialect and built-in variable names change. This skill teaches those portable fundamentals in GLSL with HLSL equivalents; use godot-shaders (or Unity/Unreal material docs) for the exact engine syntax and built-ins.

When to use

  • Use to understand or write vertex/fragment shaders and to reason about UVs, coordinate spaces, and the GPU pipeline.
  • Use to build common effects: tint/recolor, scrolling textures, dissolve, outlines, fresnel/rim light, vignette, color grading.
  • Use to translate a shader concept between GLSL and HLSL, or between engines.

When not to use: for an engine's exact shader language and built-ins, use godot-shaders (Godot shading language) or the engine's material docs. For full particle VFX systems, see unreal-niagara. For post-process stacks, defer to the engine's renderer settings.

Core workflow

  1. Know which stage you're in. The vertex shader transforms each vertex into clip space and passes data (UVs, normals) onward; the fragment/pixel shader runs per rasterized pixel and outputs a color. Most game effects live in the fragment stage.
  2. Track coordinate spaces. Positions move model → world → view → clip space; normals belong in world or view space. Mixing spaces is the most common bug.
  3. Drive effects with UVs and time. UVs are 0..1 texture coordinates; offset, scale, or distort them, and animate with a time uniform.
  4. Work per pixel, branch-light. Prefer mix, step, smoothstep, and clamp over if where possible; GPUs run pixels in lockstep, so a branch whose condition differs between neighbouring pixels runs both sides. A branch on a uniform (same for the whole draw) is cheap.
  5. Pass data via uniforms (constant per draw) and varyings (interpolated vertex→fragment). Keep texture samples few; they dominate cost.
  6. Validate source before visual testing when the tools are already available. For GLSL, run glslangValidator path/to/shader.frag with the matching stage suffix; for WGSL, run naga path/to/shader.wgsl. Check Godot .gdshader files by opening the project in Godot, which has no standalone validator for them.
  7. Verify visually and on target hardware. Shaders that look right on desktop can break on mobile (precision, missing features). Test where it ships.

Patterns

GLSL fragment snippets for desktop #version 330 (each passes glslangValidator with that header; close to Godot's canvas_item/spatial shaders). For GLSL ES 3.00 — WebGL2, three.js ShaderMaterial, PixiJS filters — add precision highp float; and set uniform defaults from code: ES rejects uniform float edge = 0.05; with "cannot initialize this type of qualifier" (Godot's shading language accepts it). See references/effects.md for the HLSL equivalents and the full outline/fresnel/vignette shaders.

1. Fragment basics: sample, tint, and combine

// Per-pixel: read the texture at this UV, multiply by a color (tint), keep alpha.
uniform sampler2D tex;
uniform vec4 tint;          // e.g. (1,0,0,1) reddens; multiply is non-destructive
in vec2 uv;                 // interpolated 0..1 texture coordinate (a "varying")
out vec4 frag;
void main() {
    vec4 c = texture(tex, uv);   // HLSL: tex.Sample(samp, uv)
    frag = c * tint;             // component-wise multiply tints without clipping
}

2. Scrolling UVs (animated texture) — frame-rate independent

// Add time * speed to the UV to scroll. fract() wraps it into 0..1 so it tiles.
uniform sampler2D tex;
uniform float time;          // seconds, supplied by the engine
uniform vec2 scroll_speed;   // UV units per second, e.g. (0.1, 0.0)
in vec2 uv;
out vec4 frag;
void main() {
    vec2 scrolled = fract(uv + scroll_speed * time);  // HLSL: frac(...)
    frag = texture(tex, scrolled);
}
// Drive with a real time uniform, not a per-frame accumulator, so speed is stable.

3. Dissolve (threshold a noise map, glow the edge)

// Hide pixels where noise < threshold; tint a thin band at the boundary.
uniform sampler2D tex;
uniform sampler2D noise_tex;     // grayscale noise, 0..1
uniform float amount;            // 0 = fully visible, 1 = fully dissolved
uniform float edg
자주 묻는 질문

버텍스 셰이더와 프래그먼트 셰이더는 어떻게 다른가요?

버텍스 단계는 각 버텍스를 화면에 놓고, 프래그먼트 단계는 각 픽셀의 색을 정합니다.

Godot 셰이더 문법도 다루나요?

정확한 엔진 문법과 내장 이름은 Godot 셰이더 스킬을 참고하라고 안내합니다.

파티클 효과도 다루나요?

본격적인 파티클 시스템은 이 스킬의 범위를 벗어나며, Unreal Niagara 안내에 속합니다.

상세 정보

작성자의 원본 설명

Write game shaders from cross-engine fundamentals — the vertex→fragment pipeline, coordinate spaces, UV math, and common 2D/3D effects (tint, UV scroll, dissolve, outline, fresnel rim, vignette) in GLSL with HLSL equivalents. Use when the user mentions shaders, fragment/pixel shader, vertex shader, UV, GLSL, HLSL, or effects like dissolve, outline, or rim light.

repo: gamedev-skills/awesome-gamedev-agent-skills

인기도

GitHub 스타
6.6k
순위
#13805
라이선스
Apache-2.0
업데이트
2026. 10. 28.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬