- Home /
What do `#pragma multi_compile` and `#pragma surface surf Standard vertex:vert nolightmap addshadow` do?
I've noticed them in pragma in a shaders for particles but don't know what it does.
SubShader
{
Tags { "RenderType"="Opaque" }
Pass
{
Tags { "LightMode" = "MotionVectors" }
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#include "Motion.cginc"
ENDCG
}
CGPROGRAM
#pragma surface surf Standard vertex:vert nolightmap addshadow
#pragma multi_compile _ UNITY_COLORSPACE_GAMMA
#pragma target 3.0
#include "Filament.cginc"
ENDCG
}
Comment
Answer by tanoshimi · Feb 23, 2017 at 12:33 PM
The first one creates variants of the shader with and without UNITY_COLORSPACE_GAMMA defined.
The second one defines a surface shader called "surf", using the standard lighting model, with a custom vertex modifier called "vert", with no lightmaps and support for shadows.
It's all explained in the manual: https://docs.unity3d.com/Manual/SL-SurfaceShaders.html