fbpx
Wikipedia

Shading language

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 "vector", "matrix", "color" and "normal". Due to the variety of target markets for 3D computer graphics, different shading languages have been developed.

Offline rendering uses shading languages to produce high-quality images, often developed by artists for photorealistic results. Rendering these shaders requires significant computational power and is typically run on large computer clusters. Some common shading languages include RenderMan Shading Language (RSL), Houdini VEX Shading Language, Gelato Shading Language, and Open Shading Language (OSL).

Real-time rendering shading languages offer more flexibility and higher hardware abstraction than previous paradigms, allowing programmers to control the rendering process with lower overhead. These shaders are designed for direct execution on GPUs and have contributed to the development of compute shaders. Some notable shading languages for real-time rendering include ARB assembly language, OpenGL shading language (GLSL), Cg programming language, DirectX Shader Assembly Language, DirectX High-Level Shader Language (HLSL), Adobe Pixel Bender and Adobe Graphics Assembly Language (AGAL), PlayStation Shader Language (PSSL), Metal Shading Language (MSL), and WebGPU Shading Language (WGSL).

As more graphics APIs emerge, developers face challenges in porting shaders between different shading languages. Common approaches include manual switching using C preprocessor statements, translating one language to another, or defining a different intermediate language like SPIR-V.

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

RenderMan Shading Language

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

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

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

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

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. 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 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.[6]

DirectX High-Level Shader Language

The High-Level Shading Language (also called HLSL for short) is a C-style shader language for DirectX 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 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 (AGAL), which offers full 3D acceleration support.[7][8] GPU acceleration for Pixel Bender was removed in Flash 11.8.[9][10]

AGAL is a low-level but platform-independent shading language, which can be compiled, for example, to the ARB assembly language[citation needed] or GLSL.

PlayStation Shader Language

Sony announced PSSL (PlayStation Shader Language) as a platform-specific shading language similar to Cg/HLSL for the PlayStation 4. It is said to be largely compatible with HLSL shaders on PC, but with additional features for the PS4 platform.[11]

Metal Shading Language

Apple has created a low-level graphics API called Metal, 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. MSL unifies vertex, fragment and compute processing.[12]

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.[13]

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:[14]

  • 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 and HLSL2GLSL 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.[15]

References

  1. ^ Staff (1986–2012). . Pixar. Pixar. Archived from the original on 25 July 2011. Retrieved 9 June 2012.
  2. ^ Staff. . Side FX. Side Effects Software Inc. Archived from the original on 22 July 2008. Retrieved 9 June 2012.
  3. ^ NVIDIA Corporation (2003–2008). . NVIDIA Gelato Zone. NVIDIA Corporation. Archived from the original on April 26, 2006. 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.
  6. ^ MSDN - DirectX and Gaming - Asm Shader Reference
  7. ^ Joseph Labrecque (2011). What's New in Adobe AIR 3. O'Reilly Media, Inc. pp. 17–26. ISBN 978-1-4493-1108-7.
  8. ^ Remi Arnaud (2011). "3D in a Web Browser". In Eric Lengyel (ed.). Game Engine Gems 2. CRC Press. pp. 207–212. ISBN 978-1-56881-437-7.
  9. ^ "Stage3D". scratch.mit.edu. Retrieved 2014-08-05.
  10. ^ Adobe Flash Player 11.8 - Bug 3591185: Pixel Bender shader performance drastically degraded in FP11.8. Closed as "NeverFix" 2014-04-22 at the Wayback Machine
  11. ^ Stenson, Richard; Ho, Chris. "PlayStation Shading Language for PS4". GDC Europe 2013.
  12. ^ Metal Shading Language Guide
  13. ^ "WebGPU Shading Language".
  14. ^ Pranckevičius, Aras (28 March 2014). "Cross Platform Shaders in 2014 · Aras' website".
  15. ^ "SPIR-V Toolchain". LunarXchange.

Notes

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

shading, language, this, article, multiple, issues, please, help, improve, discuss, these, issues, talk, page, learn, when, remove, these, template, messages, this, article, unclear, citation, style, references, used, made, clearer, with, different, consistent. This article has multiple issues Please help improve it or discuss these issues on the talk page Learn how and when to remove these template messages This article has an unclear citation style The references used may be made clearer with a different or consistent style of citation and footnoting May 2014 Learn how and when to remove this template message This article needs additional citations for verification Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources Shading language news newspapers books scholar JSTOR August 2014 Learn how and when to remove this template message This article uses bare URLs which are uninformative and vulnerable to link rot Please consider converting them to full citations to ensure the article remains verifiable and maintains a consistent citation style Several templates and tools are available to assist in formatting such as Reflinks documentation reFill documentation and Citation bot documentation August 2022 Learn how and when to remove this template message Learn how and when to remove this template message 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 vector matrix color and normal Due to the variety of target markets for 3D computer graphics different shading languages have been developed Offline rendering uses shading languages to produce high quality images often developed by artists for photorealistic results Rendering these shaders requires significant computational power and is typically run on large computer clusters Some common shading languages include RenderMan Shading Language RSL Houdini VEX Shading Language Gelato Shading Language and Open Shading Language OSL Real time rendering shading languages offer more flexibility and higher hardware abstraction than previous paradigms allowing programmers to control the rendering process with lower overhead These shaders are designed for direct execution on GPUs and have contributed to the development of compute shaders Some notable shading languages for real time rendering include ARB assembly language OpenGL shading language GLSL Cg programming language DirectX Shader Assembly Language DirectX High Level Shader Language HLSL Adobe Pixel Bender and Adobe Graphics Assembly Language AGAL PlayStation Shader Language PSSL Metal Shading Language MSL and WebGPU Shading Language WGSL As more graphics APIs emerge developers face challenges in porting shaders between different shading languages Common approaches include manual switching using C preprocessor statements translating one language to another or defining a different intermediate language like SPIR V Contents 1 Offline rendering 1 1 RenderMan Shading Language 1 2 Houdini VEX Shading Language 1 3 Gelato Shading Language 1 4 Open Shading Language 2 Real time rendering 2 1 ARB assembly language 2 2 OpenGL shading language 2 3 Cg programming language 2 4 DirectX Shader Assembly Language 2 5 DirectX High Level Shader Language 2 6 Adobe Pixel Bender and Adobe Graphics Assembly Language 2 7 PlayStation Shader Language 2 8 Metal Shading Language 2 9 WebGPU Shading Language 3 Translation 4 References 5 NotesOffline rendering EditShading 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 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 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 EditShading 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 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 control flow 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 Development of Cg was stopped in 2012 and the language is now deprecated DirectX Shader Assembly Language Edit The shader assembly language in Direct3D 8 and 9 is the main programming language for vertex 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 6 DirectX High Level Shader Language Edit The High Level Shading Language also called HLSL for short is a C style shader language for DirectX 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 Edit Adobe Systems added Pixel Bender as part of the Adobe Flash 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 AGAL which offers full 3D acceleration support 7 8 GPU acceleration for Pixel Bender was removed in Flash 11 8 9 10 AGAL is a low level but platform independent shading language which can be compiled for example to the ARB assembly language citation needed or GLSL PlayStation Shader Language Edit Sony announced PSSL PlayStation Shader Language as a platform specific shading language similar to Cg HLSL for the PlayStation 4 It is said to be largely compatible with HLSL shaders on PC but with additional features for the PS4 platform 11 Metal Shading Language Edit Apple has created a low level graphics API called Metal 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 MSL unifies vertex fragment and compute processing 12 WebGPU Shading Language Edit 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 13 Translation EditAs 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 14 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 and HLSL2GLSL 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 15 References Edit Staff 1986 2012 The RISpec Pixar Pixar Archived from the original on 25 July 2011 Retrieved 9 June 2012 Staff Houdini Side FX Side Effects Software Inc Archived from the original on 22 July 2008 Retrieved 9 June 2012 NVIDIA Corporation 2003 2008 Home NVIDIA Gelato Zone NVIDIA Corporation Archived from the original on April 26 2006 Retrieved 9 June 2012 Staff 1997 2012 OpenGL Shading Language OpenGL The Khronos Group Retrieved 9 June 2012 Staff 2012 Cg Toolkit NVIDIA Developer Zone NVIDIA Corporation Retrieved 9 June 2012 MSDN DirectX and Gaming Asm Shader Reference Joseph Labrecque 2011 What s New in Adobe AIR 3 O Reilly Media Inc pp 17 26 ISBN 978 1 4493 1108 7 Remi Arnaud 2011 3D in a Web Browser In Eric Lengyel ed Game Engine Gems 2 CRC Press pp 207 212 ISBN 978 1 56881 437 7 Stage3D scratch mit edu Retrieved 2014 08 05 Adobe Flash Player 11 8 Bug 3591185 Pixel Bender shader performance drastically degraded in FP11 8 Closed as NeverFix Archived 2014 04 22 at the Wayback Machine Stenson Richard Ho Chris PlayStation Shading Language for PS4 GDC Europe 2013 Metal Shading Language Guide WebGPU Shading Language Pranckevicius Aras 28 March 2014 Cross Platform Shaders in 2014 Aras website SPIR V Toolchain LunarXchange Notes Edit 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 Fx composer from NVIDIA home page http developer nvidia com object fx composer home html Rudy Cortes and Saty Raghavachary The RenderMan Shading Language Guide Course Technology PTR 1 edition December 27 2007 ISBN 1 59863 286 8 Retrieved from https en wikipedia org w index php title Shading language amp oldid 1149115961, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.