Shading language

From Wikipedia, the free encyclopedia
Jump to: navigation, search

A shading language is a graphics programming language adapted to programming shader effects (characterizing surfaces, volumes, and objects). Such language forms usually consist of special data types, like "color" and "normal". Due to the variety of target markets for 3D computer graphics, different shading languages have been developed.

Offline rendering[edit]

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 clusters.

RenderMan Shading Language[edit]

The RenderMan Shading Language (often referenced as RSL or SL, for short), which is defined in the RenderMan Interface Specification[1] is the most common shading language for production-quality rendering.[citation needed] 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, implemented this shader type and 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 prequantized data, which has a greater dynamic range than can be displayed on the typical output device.

Houdini VEX Shading Language[edit]

Houdini 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.[2]

Gelato Shading Language[edit]

Gelato's[3] 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[edit]

Open Shading Language (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[edit]

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.

Quite surprisingly, shaders that are designed to be executed directly on the GPU at the proper point in the pipeline for maximum performance, also scored successes in general processing because of their stream programming model.

This kind of shading language is usually bound to a graphics API, although some applications provide shading sublanguages.

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[edit]

The OpenGL Architecture Review Board established the ARB assembly language in 2002 as a standard low-level instruction set for programmable graphics processors.

High-level OpenGL shading languages often compile to ARB assembly for loading and execution. Unlike high-level shading languages, ARB assembly does not support flow control or branching. However, it continues to be used when cross-GPU portability is required.

OpenGL shading language[edit]

Also known as GLSL or glslang, this standardized[4] shading language is meant to be used with OpenGL.

The language unifies vertex and fragment processing in a single instruction set, allowing conditional loops and (more generally) branches. Historically, GLSL was preceded by the ARB assembly language.

Cg programming language[edit]

The programming language Cg, developed by NVIDIA,[5] was designed for easy and efficient production pipeline integration. The language features API independence and comes with a large variety of free tools[1] to improve asset management.

DirectX High-Level Shader Language[edit]

The high level shader language (also called HLSL for short) is a C-style shader language for DirectX 9, 10, 11, Xbox and Xbox 360. It is similar to Nvidia's Cg but is only supported by DirectX and Xbox game consoles.

Adobe Graphics Assembly Language[edit]

Adobe Systems defined AGAL (Adobe Graphics Assembly Language) as part of the Stage3D API in Adobe Flash. It is a low-level but platform-independent shading language, which can be compiled, for example, to the ARB assembly language.

Adobe Pixel Bender[edit]

Adobe Systems defined Adobe Pixel Bender as part of the Stage3D API in Adobe Flash. It can be compiled, for example, to GLSL, which it is also based on.

PlayStation Shader Language[edit]

Sony announced PSSL (PlayStation Shader Language) as a platform-specific shading language similar to HLSL for the PlayStation 4.

References[edit]

  1. ^ Staff (1986-2012). "The RISpec". Pixar. Pixar. Retrieved 9 June 2012. 
  2. ^ Staff. "Houdini". Side FX. Side Effects Software Inc. Archived from the original on 22 July 2008. Retrieved 9 June 2012. 
  3. ^ NVIDIA Corporation (2003-2008). "Home". NVIDIA Gelato Zone. NVIDIA Corporation. Archived from the original on 22 August 2008. Retrieved 9 June 2012. 
  4. ^ Staff (1997-2012). "OpenGL Shading Language". OpenGL. The Khronos Group. Retrieved 9 June 2012. 
  5. ^ Staff (2012). "Cg Toolkit". NVIDIA Developer Zone. NVIDIA Corporation. Retrieved 9 June 2012. 

Notes[edit]

  1. ^ Previous vertex shading languages (in no particular order) for OpenGL include EXT_vertex_shader, NV_vertex_program, the aforementioned ARB_vertex_program, NV_vertex_program2 and NV_vertex_program3.
  2. ^ For fragment shading nvparse is possibly the first shading language featuring high-level abstraction based on NV_register_combiners, NV_register_combiners2 for pixel math and NV_texture_shader, NV_texture_shader2 and NV_texture_shader3 for texture lookups. ATI_fragment_shader did not even provide a "string oriented" parsing facility (although it has been later added by ATI_text_fragment_shader). ARB_fragment_program, has been very successful. NV_fragment_program and NV_fragment_program2 are actually similar although the latter provides much more advanced functionality in respect to others.
  3. ^ Fx composer from NVIDIA home page, http://developer.nvidia.com/object/fx_composer_home.html
  4. Rudy Cortes and Saty Raghavachary: The RenderMan Shading Language Guide, Course Technology PTR, 1 edition (December 27, 2007), ISBN 1-59863-286-8