Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Shading language

From Wikipedia, the free encyclopedia
Graphics programming language
This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages)
icon
This article'slead sectionmay be too short to adequatelysummarize the key points. Please consider expanding the lead toprovide an accessible overview of all important aspects of the article.(May 2014)
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding 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 message)
(Learn how and when to remove this message)

Ashading language is a graphicsprogramming language made for programmingshader effects on thegraphics processing unit (unlike other programming languages, which send instructions to thecentral processing unit instead). Because of this, shading languages are usually more 'low level' languages and usually consist of specialdata types like "vector", "matrix", "color" and "normal".[citation needed]

Offline rendering

[edit]

Shading languages used inoffline rendering tend to be close tonatural language, so that no special knowledge of programming is required. Offline rendering aims to produce maximum-quality images, at the cost of greater time and compute than real-time rendering.[citation needed]

RenderMan Shading Language

[edit]

TheRenderMan Shading Language[1] (RSL or SL, for short), defined in theRenderMan Interface Specification, is a common shading language for production-quality rendering. It is also one of the first shading languages ever implemented.[citation needed]

It defines six major shader types:[citation needed]

  • Light source shaders compute the color of light emitted from a point on a light source to a point on a target surface.
  • Surface shaders model the color and position of points on an object's surface, based on incoming light and the object's physical properties.
  • Displacement shaders manipulate surface geometry independent of color.
  • Deformation shaders transform the entire space. Only one RenderMan implementation, theAIR renderer by SiTex Graphics, implemented this shader type, supporting only a single linear transformation applied to the space.
  • Volume shaders manipulate the color of light as it passes through a volume. They create effects such asfog.
  • Imager shaders describe a color transformation to final pixel values. This is like animage filter, except the imager shader operates on data prior toquantization. Such data have more 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 severalshadeop names.[2]

Gelato Shading Language

[edit]

Gelato's[3] shading language, likeHoudini'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 fewshadeops have different names and parameters.[citation needed]

Open Shading Language

[edit]

Open Shading Language (OSL) was developed bySony Pictures Imageworks for use in itsAutodesk Arnold Renderer. It is also used byBlender'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 forphysically-based renderers that supportray tracing andglobal illumination.[citation needed]

Real-time rendering

[edit]

Shading languages forreal-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. They deliver more control and richer content with less overhead.[citation needed]

Shaders that are designed to be executed directly on theGPU became useful for high-throughput general processing because of theirstream programming model; this led to the development ofcompute shaders running on similar hardware (see also:GPGPU).[citation needed]

Historically, a few such languages dominated the market;[citation needed] they are described below.

ARB assembly language

[edit]

TheOpenGL Architecture Review Board established theARB assembly language in 2002 as a standard low-level instruction set for programmable graphics processors.[4]

High-levelOpenGL 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.[citation needed]

OpenGL shading language

[edit]

Also known asGLSL orglslang, this standardized shading language is meant to be used withOpenGL.[5]

The language unifiesvertex andfragment processing in a single instruction set, allowing conditional loops andbranches. GLSL was preceded by theARB assembly language.[6]

Cg programming language

[edit]

TheCg language, developed byNvidia,[7] was designed for easy and efficient production pipeline integration. It features API independence and comes with many free tools[1] to improve asset management. Development of Cg was stopped in 2012, and the language is now deprecated.[citation needed]

DirectX Shader Assembly Language

[edit]

The shader assembly language in Direct3D 8 and 9 is the main programming language forvertex andpixel shaders inShader Model 1.0/1.1, 2.0, and 3.0. It is a direct representation of the intermediate shader bytecode which is passed to the graphics driver for execution.[citation needed]

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

DirectX High-Level Shader Language

[edit]

TheHigh-Level Shading Language (HLSL) is a C-style shader language forDirectX 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.[citation needed]

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.[citation needed]

Adobe Pixel Bender and Adobe Graphics Assembly Language

[edit]

Adobe Systems addedPixel Bender as part of theAdobe Flash 10 API. Pixel Bender could only process pixel but not 3D-vertex data. Flash 11 introduced an entirely new 3D API calledStage3D, which uses its own shading language calledAdobe Graphics Assembly Language (AGAL), which offers full 3D acceleration support.[9][10] GPU acceleration for Pixel Bender was removed in Flash 11.8.[11][12]

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

PlayStation Shader Language

[edit]

Sony announcedPlayStation Shader Language (PSSL) as a shading language similar to Cg/HLSL, but specific to thePlayStation 4. PSSL is said to be largely compatible with the HLSL shader language from DirectX 12, but with additional features for the PS4 and PS5 platforms.[13]

Metal Shading Language

[edit]

Apple has created a low-levelgraphics API, calledMetal, which runs on mostMacs made since 2012,iPhones since the5S, andiPads since theiPad Air. Metal has its own shading language called Metal Shading Language (MSL), which is based onC++14 and implemented usingclang andLLVM. MSL unifies vertex, fragment and compute processing.[14]

WebGPU Shading Language

[edit]

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

Translation

[edit]

To port shaders from one shading language to another, a few approaches are used:[16]

  • Define a common interface. For example, Cg/HLSL, GLSL, and MSL all implementC preprocessor macros, so it is possible to wrap all the different operations into a common interface. Valve's Source 2 and NVIDIA'sFXAA 3.11 do this.
  • Translate one language to the other. For example, DirectX bytecode can be partially converted to GLSL via HLSLcc, and several tools for converting GLSL to HLSL such asANGLE andHLSL2GLSL exist.
  • Define an 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.[17]

Notes

[edit]
  1. ^ Previous vertex shading languages (in no particular order) for OpenGL includeEXT_vertex_shader,NV_vertex_program, the aforementionedARB_vertex_programArchived 2007-12-26 at theWayback Machine,NV_vertex_program2 andNV_vertex_program3.
  2. ^ For fragment shadingnvparse is possibly the first shading language featuring high-level abstraction based onNV_register_combiners,NV_register_combiners2 for pixel math andNV_texture_shader,NV_texture_shader2 andNV_texture_shader3 for texture lookups.ATI_fragment_shader did not even provide a "string oriented" parsing facility (although it has been later added byATI_text_fragment_shader).ARB_fragment_programArchived 2008-01-02 at theWayback Machine, has been very successful.NV_fragment_program andNV_fragment_program2 are actually similar although the latter provides much more advanced functionality in respect to others.
  3. ^Fx composer from NVIDIA home page
  4. Rudy Cortes andSaty Raghavachary:The RenderMan Shading Language Guide, Course Technology PTR, 1 edition (December 27, 2007),ISBN 1-59863-286-8

References

[edit]
  1. ^"The RISpec".Pixar. 1986–2012. Archived fromthe original on 25 July 2011. Retrieved9 June 2012.
  2. ^"Houdini".Side FX. Side Effects Software Inc. Archived fromthe original on 22 July 2008. Retrieved9 June 2012.
  3. ^"Home".NVIDIA Gelato Zone. NVIDIA Corporation. 2003–2008. Archived fromthe original on 26 April 2006. Retrieved9 June 2012.
  4. ^"ARB_fragment_program".Khronos Group. October 8, 2013.
  5. ^"OpenGL 4.6 (Core) Specification"(PDF).Khronos Group. May 5, 2022. p. 4.
  6. ^"OpenGL Shading Language 1.2 Specification"(PDF).Khronos Group. September 7, 2006.
  7. ^"Cg Toolkit".NVIDIA Developer Zone. NVIDIA Corporation. 2012. Retrieved9 June 2012.
  8. ^"Asm Shader Reference".learn.microsoft.com. 10 December 2019.
  9. ^Joseph Labrecque (2011).What's New in Adobe AIR 3. O'Reilly Media, Inc. pp. 17–26.ISBN 978-1-4493-1108-7.
  10. ^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.
  11. ^"Stage3D". scratch.mit.edu. Retrieved5 August 2014.
  12. ^"Adobe Flash Player 11.8 - Bug 3591185". Archived fromthe original on 22 April 2014.
  13. ^Richard Stenson; Chris Ho."PlayStation Shading Language for PS4".GDC Europe 2013.
  14. ^"Metal Shading Language Specification". 3.2. Apple. 6 June 2024.
  15. ^"WebGPU Shading Language". W3C. 22 March 2025.
  16. ^Aras Pranckevičius (28 March 2014)."Cross Platform Shaders in 2014". Aras Pranckevičius.
  17. ^"SPIR-V Toolchain".LunarXchange. Archived fromthe original on 9 July 2022.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Shading_language&oldid=1337938387"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp