# shading language

> graphics programming language adapted to programming shader effects

**Wikidata**: [Q3496485](https://www.wikidata.org/wiki/Q3496485)  
**Wikipedia**: [English](https://en.wikipedia.org/wiki/Shading_language)  
**Source**: https://4ort.xyz/entity/shading-language

## Summary
A shading language is a specialized programming language designed to write shaders—small programs that control how 3-D surfaces look and how vertices are processed on a GPU. It is a subclass of programming language that adds graphics-specific keywords and data types so developers can describe color, lighting, and geometric effects in real-time rendering pipelines.

## Key Facts
- Classified as a subclass of “programming language” in Wikidata (sitelink count: 161).
- First major standardized shading language, OpenGL Shading Language (GLSL), released in 2004.
- OpenGL ES Shading Language introduced in 2009 for mobile and embedded GPUs.
- High-Level Shader Language (HLSL) has the highest sitelink count (17) among Microsoft-centric sources.
- Open Shading Language, created by Sony Pictures Imageworks, is optimized for offline film rendering (sitelink count: 5).
- Alternative names include シェーダ言語 (Japanese), Shade語言 (Korean), and 着色语言 (Chinese).
- Wikidata item sitelink count: 5; Wikipedia articles exist in Czech, English, Japanese, Korean, and Chinese.
- Freebase ID /m/05l0rl; Microsoft Academic ID (discontinued) 18670160; Encyclopedia of China (3rd ed.) ID 154912.

## FAQs
### Q: What makes a shading language different from a general-purpose language?
A: A shading language extends a base programming language with vector/matrix primitives, texture-sampling built-ins, and GPU-specific qualifiers such as “uniform” and “varying,” letting a single source file run efficiently on massively parallel graphics hardware.

### Q: Are shading languages tied to specific graphics APIs?
A: Yes. HLSL is native to Direct3D, GLSL to OpenGL and Vulkan, Metal Shading Language to Apple platforms, and WebGPU Shading Language to the upcoming WebGPU web standard; each compiler backend targets its respective API.

### Q: Can one shading language run on another API?
A: Not directly. Source must be transpiled or rewritten because each language uses different entry-point semantics, coordinate conventions, and built-in function names; tools like SPIR-V or ANGLE can help port shaders but manual tuning is usually required.

## Why It Matters
Shading languages turned fixed-function graphics pipelines into programmable ones, enabling the leap from flat-shaded triangles to cinematic lighting, normal mapping, and real-time ray tracing. By exposing the GPU’s parallel execution model through C-like syntax, they let artists and engineers encode visual rules—how metallic a surface looks, how light scatters under skin, or how water ripples—without changing the underlying engine code. This programmability powers everything from mobile game visuals to high-end film post-production, and underpins the modern GPU compute revolution that now accelerates machine-learning and scientific simulation. Without shading languages, GPUs would remain hard-wired accelerators; with them, they become the most powerful parallel processors on the planet.

## Notable For
- First widespread adoption via GLSL (2004) standardized by the Khronos Group, unifying vendor-specific assembler shaders.
- HLSL’s high sitelink count (17) reflects its dominance in PC gaming and DirectX ecosystem.
- Open Shading Language is the only major shading language purpose-built for offline, film-quality ray tracing rather than real-time rasterization.
- WebGPU Shading Language is the newest entry, aiming to bring safe, portable GPU code to web browsers with a single source language.
- Multiple national-script aliases (Japanese, Korean, Chinese) show the topic’s global relevance in computer-graphics education.

## Body
### Definition and Purpose
A shading language is a domain-specific programming language whose grammar and built-in functions are optimized for writing vertex, geometry, and fragment shaders. Shaders are short programs executed by the GPU to determine vertex positions, pixel colors, and intermediate geometric attributes. The language adds vector/matrix data types, texture-sampling intrinsics, and qualifiers that map variables to GPU registers, enabling massively parallel execution.

### Historical Milestones
- 2004 – OpenGL Shading Language (GLSL) debuts alongside OpenGL 2.0, replacing vendor-specific assembler.
- 2009 – OpenGL ES Shading Language ships, tailoring GLSL for constrained mobile GPUs.
- Microsoft’s High-Level Shader Language (HLSL) evolves in parallel, tied to DirectX 9 and onward.
- Sony Pictures Imageworks releases Open Shading Language (OSL) for offline rendering, later adopted by studios such as Pixar and ILM.
- Apple introduces Metal Shading Language in 2014, unifying graphics and compute on iOS/macOS.
- Khronos begins work on WebGPU Shading Language, targeting secure cross-platform web deployment.

### Language Family Tree
All major shading languages borrow C-style syntax but diverge in semantics:
- GLSL uses “in/out” qualifiers and layout locations for Vulkan compatibility.
- HLSL adopts semantics like “SV_Position” for Direct3D linkage.
- Metal uses “[[attribute]]” syntax and supports pointer-based argument buffers.
- OSL adds closures and automatic differentiation for ray-tracing integrators.

### Current Ecosystem
Modern engines (Unity, Unreal, Godot) abstract differences via shader graphs or cross-compilers such as SPIR-V, but developers still hand-write performance-critical kernels in the native shading language of the target API.

## Schema Markup
```json
{
  "@context": "https://schema.org",
  "@type": "Thing",
  "name": "shading language",
  "description": "A graphics programming language adapted to programming shader effects.",
  "sameAs": [
    "https://www.wikidata.org/wiki/Q30196",
    "https://en.wikipedia.org/wiki/Shading_language"
  ],
  "additionalType": "ProgrammingLanguage"
}