Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/ContrastBrightness" {
- Properties {
- _MainTex ("Base (RGB)", 2D) = "white" {}
- _Contrast ("Contrast", Float) = 0.8
- _Brightness ("Brightness", Float) = 0.1
- }
- SubShader {
- Pass {
- CGPROGRAM
- #pragma vertex vMain
- #pragma fragment fMain
- uniform sampler2D _MainTex;
- uniform float _Contrast;
- uniform float _Brightness;
- struct INPUT
- {
- float4 position : POSITION;
- float2 coord : TEXCOORD0;
- };
- struct OUTPUT
- {
- float4 position : SV_POSITION;
- float2 coord : TEXCOORD0;
- };
- OUTPUT vMain( INPUT input )
- {
- OUTPUT output;
- output.position = mul( UNITY_MATRIX_MVP, input.position );
- output.coord = input.coord;
- return output;
- }
- float4 fMain( OUTPUT input ) : COLOR
- {
- float4 col = tex2D( _MainTex, input.coord );
- col.xyz = ( ( col.xyz - 0.5.xxx ) * _Contrast.xxx ) + 0.5.xxx;
- col.xyz += _Brightness.xxx;
- return col;
- }
- ENDCG
- }
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement