High-Level Shader Language

A scene containing several different 2D HLSL shaders. Distortion of the statue is achieved purely physically, while the texture of the rectangular frame beside it is based on color intensity. The square in the background has been transformed and rotated. The partial transparency and reflection of the water in the foreground are added by a shader applied finally to the entire scene.

The High-Level Shader Language[1] or High-Level Shading Language[2] (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 for the unified shader model of Direct3D 10 and higher.

HLSL is analogous to the GLSL shading language used with the OpenGL standard. It is very similar to the Nvidia Cg shading language, as it was developed alongside it. Early versions of the two languages were considered identical, only marketed differently.[3] HLSL shaders can enable profound speed and detail increases as well as many special effects in both 2D and 3D computer graphics.[citation needed]

HLSL programs come in six forms: pixel shaders (fragment in GLSL), vertex shaders, geometry shaders, compute shaders, tessellation shaders (Hull and Domain shaders), and ray tracing shaders (Ray Generation Shaders, Intersection Shaders, Any Hit/Closest Hit/Miss Shaders). A vertex shader is executed for each vertex that is submitted by the application, and is primarily responsible for transforming the vertex from object space to view space, generating texture coordinates, and calculating lighting coefficients such as the vertex's normal, tangent, and bitangent vectors. When a group of vertices (normally 3, to form a triangle) come through the vertex shader, their output position is interpolated to form pixels within its area; this process is known as rasterization.

Optionally, an application using a Direct3D 10/11/12 interface and Direct3D 10/11/12 hardware may also specify a geometry shader. This shader takes as its input some vertices of a primitive (triangle/line/point) and uses this data to generate/degenerate (or tessellate) additional primitives or to change the type of primitives, which are each then sent to the rasterizer.

D3D11.3 and D3D12 introduced Shader Model 5.1[4] and later 6.0.[5]

  1. ^ "Writing HLSL Shaders in Direct3D 9". Microsoft Docs. Retrieved February 22, 2021.
  2. ^ "High-level shader language (HLSL)". Microsoft Docs. Retrieved February 22, 2021.
  3. ^ "Fusion Industries :: Cg and HLSL FAQ ::". August 24, 2012. Archived from the original on August 24, 2012.
  4. ^ "Shader Model 5.1 Objects". Microsoft Docs. Retrieved February 22, 2021.
  5. ^ "HLSL Shader Model 6.0". Microsoft Docs. Retrieved February 22, 2021.

Developed by StudentB