Unity has its own shader syntax called ShaderLab .
All the necessary information about this can be found on this site .
For properties, check out this link.
Since nvidia does not support CG anymore, versions of the latter unity actually compile shaders using HLSL and convert the resulting bytecode to GLSL. The CG shader code continues to work mostly unchanged. Currently, you can use modern shader functions, such as computational shaders and tessellations, which were not supported by CG using the HLSL syntax.
For example, these shader properties:
_MyColor ("Some Color", Color) = (1,1,1,1) _MyVector ("Some Vector", Vector) = (0,0,0,0) _MyRange ("My Range", Range (0, 1)) = 1 _MyFloat ("My float", Float) = 0.5 _MyInt ("My Int", int) = 1 _MyTexture2D ("Texture2D", 2D) = "white" {} _MyTexture3D ("Texture3D", 3D) = "white" {} _MyCubemap ("Cubemap", CUBE) = "" {}
will be declared for access in Cg / HLSL code as:
fixed4 _MyColor; float4 _MyVector; float _MyRange; float _MyFloat; int _MyInt; sampler2D _MyTexture2D; sampler3D _MyTexture3D; samplerCUBE _MyCubemap;
Type types in ShaderLab are mapped to Cg / HLSL variable types as follows:
• The Color and Vector properties are mapped to float4 , half4, or fixed4 variables .
• Range and Float properties are mapped to floating point , half, or fixed variables.
• Texture properties correspond to sampler2D variables for regular (2D) textures.
• Cubemaps map for samplerCUBE .
• 3D textures are displayed on sampler3D .