Shading language
From Wikipedia, the free encyclopedia
A shading language is a special programming language adapted to easily map on shader programming. Those kind of languages usually have special data types like color and normal. Because of the various target markets of 3D graphics, different shading languages have been developed: a brief overview is given below.
Contents |
[edit] Production rendering
These kind of shading languages are geared towards 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 these kinds of shaders is usually a time-consuming process. The computational power required to get this kind of shading to work can be rather expensive because of their ability to produce photorealistic results. Most of the time, production rendering is run on large computer clusters.
[edit] RenderMan Shading Language
RenderMan Shading Language, which is defined in the RenderMan Interface SpecificationRenderMan by Rob Cook, is currently used in all of Pixar's products. It's also one of the first shading languages ever implemented.
, is the most common shading language for production-quality rendering.The language actually 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 surface being illuminated.
- Surface shaders are used to model the optical properties of the object being illuminated. They output the final color and position of the point being illuminated by taking into account the incoming light and the physical properties of the object.
- Displacement shaders manipulate the surface's geometry independent of its color.
- Deformation shaders transform the entire space that a geometry is defined in. Only one RenderMan implementation, the AIR renderer, actually implements this shader type.
- Volume shaders manipulate the color of a light as it passes through a volume. They are used to create effects like 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 typically has a greater dynamic range than can be displayed on the output device.
Most of the time RenderMan is referenced, it is really meant to speak about PRMan, the RenderMan implementation from Pixar, which was the only one available for years. Further information can be found at the RenderMan repository.
[edit] Gelato Shading Language
Developed by NVIDIA, a graphics processing unit manufacturer for its Gelato rendering software.
This language is meant to interact with hardware
, providing higher computational rates while retaining cinematic image quality and functionalities.[edit] Real-time rendering
Until recently, developers did not have the same level of control over the output from the graphics pipeline of graphics cards, but shading languages for real-time rendering are now widespread. They provide both higher hardware abstraction and a more flexible programming model when compared to previous paradigms which hardcoded transformation and shading equations. This results in both giving the programmer greater control over the rendering process, and delivering richer content at lower overhead.
Quite surprisingly those shaders, which 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 also provide built-in shading languages with limited functionalities.
Historically, only few of those languages were successful in both establishing themselves and maintaining strong market position; a short description of those languages follows below.
[edit] OpenGL shading language
Also known as GLSL or glslang, this standardized high level shading language is meant to be used with OpenGL.
The language featured a very rich feature set since the beginning, unifying vertex and fragment processing in a single instruction set, allowing conditional loops and (more generally) branches.
Historically, GLSL have been preceded by various OpenGL extensions such as ARB_vertex_program, ARB_fragment_program and many others. Those were low-level, assembly-like languages with various limitations. Usage of those languages is now discouraged. Those two extensions were also preceded by other proposals which didn't survive in the new version .
[edit] Cg programming language
This languageNVIDIA has been 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.
developed byThe first Cg implementations were rather restrictive because of the hardware being abstracted but they were still innovative when compared to previous methods. Cg seems to have survived the introduction of the newer shading languages very well, mainly of its established momentum in the digital content creation area, although the language is seldom used in final products.
A distinctive feature of Cg is the use of connectors, special data structures to link the various stages of processing. Connectors are used to define the input from application to vertex processing stage and the attributes to be interpolated as input to fragment processing.
[edit] DirectX High-Level Shader Language
This is possibly the most successful language to date, mainly because of great pressure from Microsoft, combined with the fact that it was the first C-style shader language to be used for real-time rendering. The high level shader language (also called HLSL for short) was released before its main competitor, GLSL, although its feature set was later extended in two different revisions to match the GLSL feature set.
[edit] References
- ↑ https://renderman.pixar.com/products/rispec/
- ↑ NVIDIA Gelato official website, http://film.nvidia.com/page/gelato.html
- ↑ Official language specification, http://www.opengl.org/documentation/glsl/
- ↑ 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.
- ↑ 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.
- ↑ Official Cg home page, http://developer.nvidia.com/object/cg_toolkit.html
- ↑ Fx composer from NVIDIA home page, http://developer.nvidia.com/object/fx_composer_home.html