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 ...
adapted to programming shader 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'' (franchis ...
", "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 th ...
, 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 Renderman Shading Language (abbreviated RSL) is a component of the RenderMan Interface Specification, and is used to define shaders. The language syntax is C-like.
A shader written in RSL can be used without changes on any RenderMan-compliant rend ...
(often referenced as RSL or SL, for short), which is defined in the ''
RenderMan Interface Specification
The RenderMan Interface Specification, or RISpec in short, is an open API developed by Pixar Animation Studios to describe three-dimensional scenes and turn them into digital photorealistic images. It includes the RenderMan Shading Language.
As ...
'' 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
Fog is a visible aerosol consisting of tiny water droplets or ice crystals suspended in the air at or near the Earth's surface. Reprint from Fog can be considered a type of low-lying cloud usually resembling stratus, and is heavily influ ...
.
* ''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
Gelato (; ) is the common word in Italian for all kinds of ice cream. In English, it specifically refers to a frozen dessert of Italian origin. Artisanal gelato in Italy generally contains 6%–9% butterfat, which is lower than other styles o ...
'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
Open Shading Language (OSL) is a shading language developed by Sony Pictures Imageworks for use in its Arnold Renderer. It is also supported by Illumination Research's 3Delight renderer, Otoy's Octane Render, V-Ray 3, Redshift (from April 2021), ...
(OSL) was developed by Sony Pictures Imageworks for use in its Arnold Renderer. It is also used by Blender'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
Real-time computer graphics or real-time rendering is the sub-field of computer graphics focused on producing and analyzing images in real time. The term can refer to anything from rendering an application's graphical user interface ( GUI) to ...
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
In computer science, stream processing (also known as event stream processing, data stream processing, or distributed stream processing) is a programming paradigm which views data streams, or sequences of events in time, as the central input and ou ...
model; this led to the development of
compute shader
In computing, a compute kernel is a routine compiled for high throughput accelerators (such as graphics processing units (GPUs), digital signal processors (DSPs) or field-programmable gate arrays (FPGAs)), separate from but used by a main progr ...
s 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
ARB assembly language is a low-level shading language, which can be characterized as an assembly language. It was created by the OpenGL Architecture Review Board (ARB) to standardize GPU instructions controlling the hardware graphics pipeline.
Hi ...
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 hardwa ...
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 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 hardwa ...
.
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
ARB assembly language is a low-level shading language, which can be characterized as an assembly language. It was created by the OpenGL Architecture Review Board (ARB) to standardize GPU instructions controlling the hardware graphics pipeline.
Hi ...
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
The High-Level Shader Language or High-Level Shading Language (HLSL) is a proprietary shading language developed by Microsoft for the Direct3D 9 API to augment the shader assembly language, and went on to become the required 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 "Direct", ...
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
Adobe Inc. ( ), originally called Adobe Systems Incorporated, is an American multinational computer software company incorporated in Delaware
and headquartered in San Jose, California. It has historically specialized in software for the crea ...
added
Pixel Bender
Adobe Pixel Bender, previously codenamed Hydra, is a programming language created by Adobe Systems for the description of image processing algorithms. The syntax is based on GLSL, and a Pixel Bender program is analogous to an OpenGL fragment ...
as part of the
Adobe Flash
Adobe Flash (formerly Macromedia Flash and FutureSplash) is a multimedia Computing platform, software platform used for production of Flash animation, animations, rich web applications, application software, desktop applications, mobile apps, mo ...
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.
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
The PlayStation 4 system software is the updatable firmware and operating system of the PlayStation 4. The operating system is Orbis OS, based on FreeBSD 9.
Technology System
The native operating system of the PlayStation 4 is Orbis OS, whi ...
) 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 typicall ...
, 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 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 represen ...
. MSL unifies vertex, fragment and compute processing.
WebGPU Shading Language
WebGPU Shading Language (WGSL) is the shader language for
WebGPU
WebGPU is the working name for a future web standard and JavaScript API for accelerated graphics and compute, aiming to provide "modern 3D graphics and computation capabilities". It is developed by the W3C ''GPU for the Web'' Community Group wi ...
. 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
Fast approximate anti-aliasing (FXAA) is a screen-space anti-aliasing algorithm created by Timothy Lottes at Nvidia.
FXAA 3 is released under a public domain license. A later version, FXAA 3.11, is released under a 3-clause BSD license.
Algor ...
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 Ray (geometry), rays, called the ''Side (plane geometry), sides'' of the angle, sharing a common endpoint, called the ''vertex (geometry), vertex'' of the angle.
Angles formed by two ...
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
Standard Portable Intermediate Representation (SPIR) is an intermediate language for parallel compute and graphics by Khronos Group. It is used in multiple execution environments, including the Vulkan graphics API and the OpenCL compute API, to re ...
is designed partially for this purpose. It can be generated from HLSL or GLSL, and be decompiled into HLSL, GLSL, or MSL.
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