1.0
2.2
Синтаксис:
Используется glsl
Shader "ImageProc/Gamma" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_GammaCorrect("Gamma Correct", Range(1.0,2.2)) = 1.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
float _GammaCorrect;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
half target = step(1.6, _GammaCorrect);
float4 to1 = pow((c + 0.055)/ 1.055, 2.4);
float4 to22 = pow(1.055 * c, 1.0/2.4)- 0.055;
c = lerp(to1, to22, target);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_GammaCorrect("Gamma Correct", Range(1.0,2.2)) = 1.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
float _GammaCorrect;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
half target = step(1.6, _GammaCorrect);
float4 to1 = pow((c + 0.055)/ 1.055, 2.4);
float4 to22 = pow(1.055 * c, 1.0/2.4)- 0.055;
c = lerp(to1, to22, target);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}