Write High-Level ShaderA program that runs on the GPU. More info
See in Glossary Language (HLSL) vertex and fragment shader programs inside a Pass block in a custom ShaderLabUnity’s language for defining the structure of Shader objects. More info
See in Glossary shader.
| Page | Description |
|---|---|
| Introduction to HLSL shader programs | Learn about writing shader programs in HLSL in Unity, and vertex and fragment shaders. |
| Add an HLSL shader program | Use the HLSLPROGRAM directive to add a shader program to a shader pass. |
| Reuse HLSL code | Include or duplicate HLSL in different places, or share #pragma directives across different shaders. |
| Input data into HLSL | Create a struct that declares shader variables and connects them to the vertex data of the meshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More infoSee in Glossary. |
| Sample a texture in HLSL | Declare and sample a texture in HLSL using a sampler. |
| Writing HLSL for different graphics APIs | Write HLSL to take into account how graphics rendering differs between different graphics APIs. |
| Use 16-bit precision in shaders | Use 16-bit precision in GPU calculations, so shaders use less memory, bandwidth, and power, and calculations are faster. |
| Pass information to the shader compiler | Use the #define, #pragma, and #define_for_platform_compiler directives to pass information to the shader compiler. |