Guest User

Untitled

a guest
Feb 12th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1.  
  2. Shader "Custom/Contrast And Brightness" {
  3. Properties {
  4. _MainTex ("Base (RGB)", 2D) = "white" {}
  5. _Contrast ("Contrast", Float) = 1.3
  6. _Brightness ("Brightness", Float) = 0.1
  7. }
  8. SubShader {
  9. Pass {
  10. CGPROGRAM
  11.  
  12. #pragma vertex vMain
  13. #pragma fragment fMain
  14.  
  15. uniform sampler2D _MainTex;
  16. uniform float _Contrast;
  17. uniform float _Brightness;
  18.  
  19. struct INPUT
  20. {
  21. float4 position : POSITION;
  22. float2 coord : TEXCOORD0;
  23. };
  24.  
  25. struct OUTPUT
  26. {
  27. float4 position : SV_POSITION;
  28. float2 coord : TEXCOORD0;
  29. };
  30.  
  31. OUTPUT vMain( INPUT input )
  32. {
  33. OUTPUT output;
  34. output.position = mul( UNITY_MATRIX_MVP, input.position );
  35. output.coord = input.coord;
  36. return output;
  37. }
  38.  
  39. float4 fMain( OUTPUT input ) : COLOR
  40. {
  41. float4 col = tex2D( _MainTex, input.coord );
  42. col.xyz += _Brightness.xxx;
  43. col.xyz = ( ( col.xyz - 0.5.xxx ) * _Contrast.xxx ) + 0.5.xxx;
  44. return col;
  45. }
  46.  
  47. ENDCG
  48. }
  49. }
  50. FallBack "Diffuse"
  51. }
Advertisement
Add Comment
Please, Sign In to add comment