HOME

TheInfoList



OR:

A shading language is a graphics
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming l ...
adapted to programming
shader In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene - a process known as '' shading''. Shaders have evolved to perform a variety of spec ...
effects (characterizing surfaces, volumes, and objects). Such language forms usually consist of special
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
s, like "vector", "
matrix Matrix most commonly refers to: * ''The Matrix'' (franchise), an American media franchise ** '' The Matrix'', a 1999 science-fiction action film ** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchi ...
", "color" and " normal". Due to the variety of target markets for
3D computer graphics 3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for t ...
, different shading languages have been developed.


Offline rendering

Shading languages used in offline rendering produce maximum image quality. Material properties are totally abstracted, little programming skill and no hardware knowledge is required. These kind of shaders are often developed by artists to get the right "look", just as texture mapping, lighting and other facets of their work. Processing such shaders is time-consuming. The computational power required can be expensive because of their ability to produce photorealistic results. Most of the time, production rendering is run on large
computer cluster A computer cluster is a set of computers that work together so that they can be viewed as a single system. Unlike grid computers, computer clusters have each node set to perform the same task, controlled and scheduled by software. The comp ...
s.


RenderMan Shading Language

The RenderMan Shading Language (often referenced as RSL or SL, for short), which is defined in the '' RenderMan Interface Specification'' is the most common shading language for production-quality rendering. It is also one of the first shading languages ever implemented. The language defines six major shader types: * ''Light source shaders'' compute the color of the light emitted from a point on the light source towards a point on the target surface. * ''Surface shaders'' model the optical properties of an illuminated object. They output the final color and position of the point by considering the incoming light and the object's physical properties. * ''Displacement shaders'' manipulate surface geometry independent of color. * ''Deformation shaders'' transform the entire space of a geometry. Only one RenderMan implementation, the AIR renderer by SiTex Graphics, implemented this shader type, supporting only a single linear transformation applied to the space (this was more like a Transformation shader, if such a type existed). * ''Volume shaders'' manipulate the color of a light as it passes through a volume. They create effects such as fog. * ''Imager shaders'' describe a color transformation to final pixel values. This is much like an image filter, however the imager shader operates on data prior to quantization. Such data has a greater dynamic range and color resolution than can be displayed on a typical output device.


Houdini VEX Shading Language

Houdini Harry Houdini (, born Erik Weisz; March 24, 1874 – October 31, 1926) was a Hungarian-American escape artist, magic man, and stunt performer, noted for his escape acts. His pseudonym is a reference to his spiritual master, French magician ...
VEX (Vector Expressions) shading language (often abbreviated to "VEX") is closely modeled after RenderMan. However, its integration into a complete 3D package means that the shader writer can access the information inside the shader, a feature that is not usually available in a rendering context. The language differences between RSL and VEX are mainly syntactic, in addition to differences regarding the names of several shadeop names.


Gelato Shading Language

Gelato's shading language, like Houdini's VEX, is closely modeled after RenderMan. The differences between Gelato Shading Language and RSL are mainly syntactical — Gelato uses semicolons instead of commas to separate arguments in function definitions and a few shadeops have different names and parameters.


Open Shading Language

Open Shading Language (OSL) was developed by Sony Pictures Imageworks for use in its Arnold Renderer. It is also used by
Blender A blender (sometimes called a mixer or liquidiser in British English) is a kitchen and laboratory appliance used to mix, crush, purée or emulsify food and other substances. A stationary blender consists of a blender container with a rotating me ...
's Cycles render engine. OSL's surface and volume shaders define how surfaces or volumes scatter light in a way that allows for importance sampling; thus, it is well suited for physically-based renderers that support ray tracing and global illumination.


Real-time rendering

Shading languages for real-time rendering are now widespread. They provide both higher hardware abstraction and a more flexible programming model than previous paradigms which hardcoded transformation and shading equations. This gives the programmer greater control over the rendering process and delivers richer content at lower overhead. Shaders that are designed to be executed directly on the GPU became useful for high throughput general processing because of their stream programming model; this led to the development of compute shaders running on similar hardware (see also: GPGPU). Historically, only few such languages were successful in both establishing themselves and maintaining strong market position; a short description of those languages follows below.


ARB assembly language

The
OpenGL Architecture Review Board The OpenGL Architecture Review Board (ARB) was an industry consortium that governed the OpenGL specification. It was formed in 1992, and defined the conformance tests, approved the OpenGL specification and advanced the standard. On July 31, 2006, ...
established the ARB assembly language in 2002 as a standard low-level instruction set for programmable graphics processors. High-level
OpenGL OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
shading languages often compile to ARB assembly for loading and execution. Unlike high-level shading languages, ARB assembly does not support control flow or branching. However, it continues to be used when cross-GPU portability is required.


OpenGL shading language

Also known as
GLSL OpenGL Shading Language (GLSL) is a high-level shading language with a syntax based on the C programming language. It was created by the OpenGL ARB (OpenGL Architecture Review Board) to give developers more direct control of the graphics pip ...
or ''glslang'', this standardized shading language is meant to be used with
OpenGL OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
. The language unifies
vertex Vertex, vertices or vertexes may refer to: Science and technology Mathematics and computer science *Vertex (geometry), a point where two or more curves, lines, or edges meet *Vertex (computer graphics), a data structure that describes the position ...
and
fragment processing Fragment processing is a term in computer graphics referring to a collection of operations applied to fragments generated by the rasterization operation in the rendering pipeline. During the rendering of computer graphics, the rasterization step t ...
in a single instruction set, allowing conditional loops and (more generally) branches. Historically, GLSL was preceded by the ARB assembly language.


Cg programming language

The programming language Cg, developed by
NVIDIA Nvidia CorporationOfficially written as NVIDIA and stylized in its logo as VIDIA with the lowercase "n" the same height as the uppercase "VIDIA"; formerly stylized as VIDIA with a large italicized lowercase "n" on products from the mid 1990s to ...
, was designed for easy and efficient production pipeline integration. The language features API independence and comes with a large variety of free tools to improve asset management. Development of Cg was stopped in 2012 and the language is now deprecated.


DirectX Shader Assembly Language

The shader assembly language in Direct3D 8 and 9 is the main programming language for
vertex Vertex, vertices or vertexes may refer to: Science and technology Mathematics and computer science *Vertex (geometry), a point where two or more curves, lines, or edges meet *Vertex (computer graphics), a data structure that describes the position ...
and pixel shaders in Shader Model 1.0/1.1, 2.0, and 3.0. The shader assembly language is a direct representation of the intermediate shader bytecode which is passed to the graphics driver for execution. The shader assembly language cannot be directly used to program unified Shader Model 4.0, 4.1, 5.0, and 5.1, although it retains its function as a representation of the intermediate bytecode for debug purposes.MSDN - DirectX and Gaming - Asm Shader Reference
/ref>


DirectX High-Level Shader Language

The High-Level Shading Language (also called HLSL for short) is a C-style shader language for
DirectX Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direc ...
9 and higher and Xbox game consoles. It is related to Nvidia's Cg but is only supported by DirectX and Xbox. HLSL programs are compiled into bytecode equivalent of DirectX shader assembly language. HLSL was introduced as an optional alternative to the shader assembly language in Direct3D 9, but became a requirement in Direct3d 10 and higher, where the shader assembly language is deprecated.


Adobe Pixel Bender and Adobe Graphics Assembly Language

Adobe Systems added Pixel Bender as part of the
Adobe Flash Adobe Flash (formerly Macromedia Flash and FutureSplash) is a multimedia software platform used for production of animations, rich web applications, desktop applications, mobile apps, mobile games, and embedded web browser video players. Fla ...
10 API. Pixel Bender could only process pixel but not 3D-vertex data. Flash 11 introduced an entirely new 3D API called Stage3D, which uses its own shading language called
Adobe Graphics Assembly Language Stage3D (codenamed ''Molehill'') is an Adobe Flash Player API for rendering interactive 3D graphics with GPU-acceleration, within Flash games and applications. Flash Player or AIR applications written in ActionScript 3 may use Stage3D to render 3D ...
(AGAL), which offers full 3D acceleration support. GPU acceleration for Pixel Bender was removed in Flash 11.8. AGAL is a low-level but platform-independent shading language, which can be compiled, for example, or
GLSL OpenGL Shading Language (GLSL) is a high-level shading language with a syntax based on the C programming language. It was created by the OpenGL ARB (OpenGL Architecture Review Board) to give developers more direct control of the graphics pip ...
.


PlayStation Shader Language

Sony , commonly stylized as SONY, is a Japanese multinational conglomerate corporation headquartered in Minato, Tokyo, Japan. As a major technology company, it operates as one of the world's largest manufacturers of consumer and professional ...
announced PSSL ( PlayStation Shader Language) as a platform-specific shading language similar to Cg/HLSL for the
PlayStation 4 The PlayStation 4 (PS4) is a home video game console developed by Sony Interactive Entertainment. Announced as the successor to the PlayStation 3 in February 2013, it was launched on November 15, 2013, in North America, November 29, 2013 in ...
. It is said to be largely compatible with HLSL shaders on PC, but with additional features for the PS4 platform.


Metal Shading Language

Apple has created a low-level graphics API called
Metal A metal (from Greek μέταλλον ''métallon'', "mine, quarry, metal") is a material that, when freshly prepared, polished, or fractured, shows a lustrous appearance, and conducts electricity and heat relatively well. Metals are typi ...
, which runs on most Macs made since 2012, iPhones since the 5S, and iPads since the iPad Air. Metal introduces its own shading language called Metal Shading Language (MSL), which is based on C++14 and implemented using
clang Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages, as well as the OpenMP, OpenCL, RenderScript, CUDA, and HIP frameworks. It acts as a drop-in replacement for the GNU Compiler Collection ...
and
LLVM LLVM is a set of compiler and toolchain technologies that can be used to develop a front end for any programming language and a back end for any instruction set architecture. LLVM is designed around a language-independent intermediate repre ...
. MSL unifies vertex, fragment and compute processing.


WebGPU Shading Language

WebGPU Shading Language (WGSL) is the shader language for WebGPU. That is, an application using the WebGPU API uses WGSL to express the programs, known as shaders, that run on the GPU.


Translation

As more and more graphics APIs become available, developers face the problem of porting shaders from one shading languages to another. A few approaches are used: * Manual switching using C preprocessor (CPP) statements. Cg/HLSL, GLSL, and MSL all implement CPP macros, so it is possible to wrap all the different operations into a common interface. Valve's Source 2 and NVIDIA's FXAA 3.11 do this. * Translate one language to the other. DirectX bytecode partially can be converted to GLSL via HLSLcc, and several tools for converting GLSL to HLSL such as
ANGLE In Euclidean geometry, an angle is the figure formed by two rays, called the '' sides'' of the angle, sharing a common endpoint, called the '' vertex'' of the angle. Angles formed by two rays lie in the plane that contains the rays. Angles ...
and
HLSL2GLSL HLSL2GLSL is a command line tool and a library that translates shaders written in High Level Shader Language (HLSL) for Direct3D 9 into the OpenGL Shading Language (GLSL). HLSL2GLSL was originally released by ATI Technologies under a BSD License ...
exist. * Define a different intermediate language. SPIR-V is designed partially for this purpose. It can be generated from HLSL or GLSL, and be decompiled into HLSL, GLSL, or MSL.


References


Notes

# Previous vertex shading languages (in no particular order) for OpenGL includ
EXT_vertex_shaderNV_vertex_program
the aforementione
ARB_vertex_programNV_vertex_program2
an
NV_vertex_program3
# For fragment shadin

is possibly the first shading language featuring high-level abstraction based o
NV_register_combinersNV_register_combiners2
for pixel math an
NV_texture_shaderNV_texture_shader2
an
NV_texture_shader3
for texture lookups
ATI_fragment_shader
did not even provide a "string oriented" parsing facility (although it has been later added b
ATI_text_fragment_shader

ARB_fragment_program
has been very successful
NV_fragment_program
an
NV_fragment_program2
are actually similar although the latter provides much more advanced functionality in respect to others. # Fx composer from NVIDIA home page, http://developer.nvidia.com/object/fx_composer_home.html # Rudy Cortes and
Saty Raghavachary , commonly written AEON Co., Ltd., is a Japanese multinational holding company of ÆON Group. It has its headquarters in Mihama-ku, Chiba, Chiba Prefecture.Programming language classification