1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
- Shader "Santa/Diffuse" {
- Properties {
- _Color ("Tint", COLOR) = (1,1,1,1)
- _Light ("Light", Range (0.01,3)) = 1
- _Contrast ("Contrast", Range (-5.0,5.0)) = 0.5
- _MainTex ("Base (RGB)", 2D) = "white" {}
- _Lightmap ("Lightmap x2 (RGB)", 2D) = "white" {}
- }
- SubShader { Tags { "Queue" = "Transparent" }
- Pass { //Blend SrcAlpha OneMinusSrcAlpha
- //Fog { Mode Off }
- CGPROGRAM
-
- #pragma vertex vert
- #pragma fragment frag
- #pragma multi_compile_fog
- #include "UnityCG.cginc"
- uniform float4 _Color;
- uniform Float _Light;
- uniform Float _Contrast;
- uniform sampler2D _MainTex;
- uniform sampler2D _Lightmap;
-
-
- // vertex input: position, color
- struct appdata
- {
- float4 vertex : POSITION;
- fixed4 color : COLOR;
- float4 uv0 : TEXCOORD0;
- float4 uv1 : TEXCOORD1;
- };
- struct v2f
- {
- float4 pos : SV_POSITION;
- fixed4 color : COLOR;
- float4 uv0 : TEXCOORD0;
- float4 uv1 : TEXCOORD1;
- UNITY_FOG_COORDS(n)
- };
-
- v2f vert (appdata v)
- {
- v2f o;
- o.pos = UnityObjectToClipPos( v.vertex );
- o.color = v.color;
- o.uv0 = v.uv0;
- o.uv1 = v.uv1;
- UNITY_TRANSFER_FOG(o, o.pos);
-
- return o;
- }
-
- fixed4 frag (v2f i) : SV_Target
- {
- fixed4 c = tex2D(_MainTex, i.uv0) * tex2D(_Lightmap, i.uv1) * _Light * i.color * _Color;
- _Contrast += 1;
- c = c - _Contrast * (c - 1.0f) * c *(c - 0.5f);
-
- UNITY_APPLY_FOG(i.fogCoord, c);
- return c;
- }
- ENDCG
- }
- }
- }
|