SHOW:
|
|
- or go back to the newest paste.
| 1 | - | |
| 1 | + | |
| 2 | Properties {
| |
| 3 | _MainTex ("Base (RGB)", 2D) = "white" {}
| |
| 4 | } | |
| 5 | - | _Contrast ("Contrast", Float) = 1.3
|
| 5 | + | |
| 6 | - | _Brightness ("Brightness", Float) = 0.1
|
| 6 | + | |
| 7 | CGPROGRAM | |
| 8 | ||
| 9 | #pragma vertex vMain | |
| 10 | #pragma fragment fMain | |
| 11 | ||
| 12 | uniform sampler2D _MainTex; | |
| 13 | uniform float _Contrast; | |
| 14 | uniform float _Brightness; | |
| 15 | ||
| 16 | struct INPUT | |
| 17 | {
| |
| 18 | float4 position : POSITION; | |
| 19 | float2 coord : TEXCOORD0; | |
| 20 | }; | |
| 21 | ||
| 22 | struct OUTPUT | |
| 23 | {
| |
| 24 | float4 position : SV_POSITION; | |
| 25 | float2 coord : TEXCOORD0; | |
| 26 | }; | |
| 27 | ||
| 28 | OUTPUT vMain( INPUT input ) | |
| 29 | {
| |
| 30 | OUTPUT output; | |
| 31 | output.position = mul( UNITY_MATRIX_MVP, input.position ); | |
| 32 | output.coord = input.coord; | |
| 33 | return output; | |
| 34 | } | |
| 35 | ||
| 36 | float4 fMain( OUTPUT input ) : COLOR | |
| 37 | {
| |
| 38 | // tu hardkodujemy jako consty zeby dzialalo z SetReplacementShader() | |
| 39 | const float contrast = 1.3; | |
| 40 | const float brightness = 0.1; | |
| 41 | - | float4 col = tex2D( _MainTex, input.coord ); |
| 41 | + | |
| 42 | - | col.xyz += _Brightness.xxx; |
| 42 | + | float4 col = tex2D( _MainTex, input.coord ); |
| 43 | - | col.xyz = ( ( col.xyz - 0.5.xxx ) * _Contrast.xxx ) + 0.5.xxx; |
| 43 | + | col.xyz = ( ( col.xyz - 0.5.xxx ) * contrast.xxx ) + 0.5.xxx; |
| 44 | - | return col; |
| 44 | + | col.xyz += brightness.xxx; |
| 45 | return col; | |
| 46 | } | |
| 47 | ||
| 48 | ENDCG | |
| 49 | } | |
| 50 | } | |
| 51 | FallBack "Diffuse" | |
| 52 | } |