shader-programming-glsl

Featured

Expert guide for writing efficient GLSL shaders (Vertex/Fragment) for web and game engines, covering syntax, uniforms, and common effects.

AI & Automation 39,350 stars 6386 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Shader Programming GLSL ## Overview A comprehensive guide to writing GPU shaders using GLSL (OpenGL Shading Language). Learn syntax, uniforms, varying variables, and key mathematical concepts like swizzling and vector operations for visual effects. ## When to Use This Skill - Use when creating custom visual effects in WebGL, Three.js, or game engines. - Use when optimizing graphics rendering performance. - Use when implementing post-processing effects (blur, bloom, color correction). - Use when procedurally generating textures or geometry on the GPU. ## Step-by-Step Guide ### 1. Structure: Vertex vs. Fragment Understand the pipeline: - **Vertex Shader**: Transforms 3D coordinates to 2D screen space (`gl_Position`). - **Fragment Shader**: Colors individual pixels (`gl_FragColor`). ```glsl // Vertex Shader (basic) attribute vec3 position; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } ``` ```glsl // Fragment Shader (basic) uniform vec3 color; void main() { gl_FragColor = vec4(color, 1.0); } ``` ### 2. Uniforms and Varyings - `uniform`: Data constant for all vertices/fragments (passed from CPU). - `varying`: Data interpolated from vertex to fragment shader. ```glsl // Passing UV coordinates varying vec2 vUv; // In Vertex Shader void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } // In Fragment Shader...

Details

Author
sickn33
Repository
sickn33/antigravity-awesome-skills
Created
4 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category