In Unity, you usually write shader programs in High-Level Shader Language (HLSL). To add HLSL code to your shader asset, add the code in a shader code block.
Note: Unity also supports writing shader programs in other languages like OpenGL Shading Language (GLSL), but this isn’t generally needed or recommended.
There are two main types of shader programs you write in HLSL:
To make it easier to write shaders across different HLSL versions, graphics APIs, and platforms, Unity provides shader libraries with preprocessor macros. For more information, refer to Shader methods in the Universal Render Pipeline (URP) or Shader methods in the Built-In Render Pipeline.
For general information on writing HLSL, refer to the HLSL documentation on the Microsoft website.