Import a file from the URP shader library
Use the include directive in HLSL to import a URP shader file.
Read time 1 minuteLast updated 25 days ago
The High-Level Shader Language (HLSL) shader files for the Universal Render Pipeline (URP) are in the folder in your project.
Packages/com.unity.render-pipelines.universal/ShaderLibrary/To import a shader file into a custom shader file, add an directive inside the in your shader file. For example:
#includeHLSLPROGRAMHLSLPROGRAM...#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"...ENDHLSL
You can then use the helper methods from the file. For example:
float3 cameraPosition = GetCameraPositionWS();
Refer to Shader methods in URP for more information about the different shader files.
You can also import shader files from the core Scriptable Render Pipeline (SRP). Refer to Shader methods in Scriptable Render Pipeline (SRP) Core.
Examples
Refer to Writing custom shaders for examples of using variables and helper methods from the files in the URP shader library.